commonMain.korlibs.math.numeric.FixedPoint16.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of korma Show documentation
Show all versions of korma Show documentation
Mathematic library for Multiplatform Kotlin 1.3
package korlibs.math.numeric
/*
inline class FixedPoint16(val value: Int) {
constructor(integral: Int, fraction: Int) : this((integral shl 16) or (fraction and 0xFFFF))
val integral: Int get() = value shr 16
val fraction: Int get() = value and 0xFFFF
operator fun plus(that: FixedPoint16) = FixedPoint16(this.integral + that.integral, this.fraction + that.fraction)
operator fun minus(that: FixedPoint16) = FixedPoint16(this.integral - that.integral, this.fraction - that.fraction)
fun toDouble() = integral.toDouble() + (fraction.toDouble() / 0x10000)
}
*/
© 2015 - 2025 Weber Informatics LLC | Privacy Policy