Socket
Book a DemoInstallSign in
Socket

top.ltfan.math:math-js

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

top.ltfan.math:math-js

A Kotlin multiplatform library for mathematical operations and utilities.

Source
mavenMaven
Version
0.1.2
Version published
Maintainers
1
Source

ltmath

Maven Central Version

A Kotlin multiplatform library for mathematical operations and utilities.

Getting Started

To use ltmath in your Kotlin Multiplatform project, add the following dependency to your build.gradle.kts file:

dependencies {
    implementation("top.ltfan.math:math:<version>")
}

Or if you are using Gradle Version Catalogs, add the following to your gradle/libs.versions.toml:

[versions]
ltmath = "<version>"

[libraries]
ltmath = { module = "top.ltfan.math:math", version.ref = "math" }

Make sure your settings.gradle.kts includes the repository:

dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
}

Features

Angle

Represents an angle in degrees or radians, providing conversion, normalization, and arithmetic operations.

Here's a quick example of how to use the Angle class:

// Basic usage of the Angle class

val a = 180.degrees
val b = Angle.fromRadians(PI)
val c = 1.piRadians
// Angle operations

val sum = a + b // Adds two angles, result in the type of the first operand (Degrees)
val normalized = sum.normalized // Normalizes the angle to the range [0, 360) for degrees or [0, 2π) for radians

val radians = a.radians // Converts degrees to radians, resulting in a `Double`
val degrees = b.degrees // Converts radians to degrees, resulting in a `Double`
val value = c.radians // Gets the value in radians, which is a `Double`
// Trigonometric functions. Shortcuts of `kotlin.math` functions for `Angle` type.

val sineValue = a.sin // Computes the sine of the angle, resulting in a `Double`

val angleFromAtan2 =
    atan2(1.0, 1.0) // Computes the angle from the arctangent of two values, resulting in an `Angle.Radians`

Platforms

  • JVM (including Android)
  • macOS (x64, arm64)
  • iOS (SimulatorArm64, X64, Arm64)
  • Linux (x64, arm64)
  • watchOS (SimulatorArm64, X64, Arm32, Arm64, DeviceArm64)
  • tvOS (SimulatorArm64, X64, Arm64)
  • Android Native (X64, X86, Arm64, Arm32)
  • Windows (mingwX64)
  • JavaScript (Browser, Node.js)
  • WebAssembly (Browser, Node.js, D8)

For more details, see the Kotlin Multiplatform documentation.

For Kotlin/Native support, see the Kotlin/Native documentation.

Contributing

We welcome contributions! Please submit issues or pull requests for any bugs, features, or improvements.

License

This project is licensed under the MIT License. See the LICENSE file for details.

FAQs

Package last updated on 24 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts