Skip to content

A Kotlin Multiplatform port of java.math functions not currently included in the standard library

License

Notifications You must be signed in to change notification settings

erikc5000/javamath2kmp

Repository files navigation

JavaMath2KMP

A Kotlin Multiplatform port of Java math functions not included in the standard library — primarily, checked arithmetic operations.

Java JavaMath2KMP Equivalent
Math.floorDiv(x, y) x floorDiv y
Math.floorMod(x, y) x floorMod y
Math.addExact(x, y) x plusExact y
Math.subtractExact(x, y) x minusExact y
Math.multiplyExact(x, y) x timesExact y
Math.negateExact(n) n.negateExact()
Math.incrementExact(n) n.incExact()
Math.decrementExact(n) n.decExact()
Math.absExact(n) absExact(n)
Math.toIntExact(n) n.toIntExact()

Floor division and floor modulus were added to the standard library in 1.5, but the existing infix functions are preserved here with JVM implementations backed by java.Math.

Gradle Setup

implementation("dev.erikchristensen.javamath2kmp:javamath2kmp:1.1")

About

A Kotlin Multiplatform port of java.math functions not currently included in the standard library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages