Package-level declarations

Types

Link copied to clipboard
interface IsAlmostEquals<T>
Link copied to clipboard
interface IsAlmostEqualsF<T>

Properties

Link copied to clipboard

Checks if this is even (multiple of two)

Link copied to clipboard

Checks if this is odd (not multiple of two)

Link copied to clipboard

Checks if this value is power of two

Link copied to clipboard

Returns the next power of two of this

Link copied to clipboard
const val PI2F: Float
Link copied to clipboard
const val PIF: Float
Link copied to clipboard

Returns the previous power of two of this

Link copied to clipboard

Signs of the value. Zero will be converted into -1

Link copied to clipboard

Signs of the value. Zero will be converted into +1

Link copied to clipboard

Returns an Int representing this Byte as if it was unsigned 0x00..0xFF

Returns a Long representing this Int as if it was unsigned 0x00000000L..0xFFFFFFFFL

Returns an Int representing this Short as if it was unsigned 0x0000..0xFFFF

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Double.clamp(min: Double, max: Double): Double
fun Float.clamp(min: Float, max: Float): Float
fun Int.clamp(min: Int, max: Int): Int
fun Long.clamp(min: Long, max: Long): Long

Clamps this value into the range min and max

Link copied to clipboard

Clamps this value into the range 0 and 1

Link copied to clipboard

Clamps the integer value in the 0..255 range

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Double.convertRange(srcMin: Double, srcMax: Double, dstMin: Double, dstMax: Double): Double
fun Float.convertRange(srcMin: Float, srcMax: Float, dstMin: Float, dstMax: Float): Float
fun Int.convertRange(srcMin: Int, srcMax: Int, dstMin: Int, dstMax: Int): Int
fun Long.convertRange(srcMin: Long, srcMax: Long, dstMin: Long, dstMax: Long): Long

Converts this value considering it was in the range srcMin..srcMax into dstMin..dstMax, if the value is not inside the range the output value will be outside the destination range

Link copied to clipboard
fun Double.convertRangeClamped(srcMin: Double, srcMax: Double, dstMin: Double, dstMax: Double): Double
fun Float.convertRangeClamped(srcMin: Float, srcMax: Float, dstMin: Float, dstMax: Float): Float
fun Int.convertRangeClamped(srcMin: Int, srcMax: Int, dstMin: Int, dstMax: Int): Int
fun Long.convertRangeClamped(srcMin: Long, srcMax: Long, dstMin: Long, dstMax: Long): Long

Converts this value considering it was in the range srcMin..srcMax into dstMin..dstMax, if the value is not inside the range the output value will be clamped to the nearest bound

Link copied to clipboard
fun Int.cycle(min: Int, max: Int): Int
Link copied to clipboard
fun Int.cycleSteps(min: Int, max: Int): Int
Link copied to clipboard
infix fun Int.divCeil(that: Int): Int

Divides this into that rounding to the ceil

infix fun Long.divCeil(other: Long): Long
Link copied to clipboard
infix fun Int.divFloor(that: Int): Int

Divides this into that rounding to the floor

Link copied to clipboard
infix fun Int.divRound(that: Int): Int

Divides this into that rounding to the round

Link copied to clipboard
inline fun fract(value: Double): Double
inline fun fract(value: Float): Float
Link copied to clipboard
fun ilog2(v: Int): Int

Performs a fast integral logarithmic of base two

Link copied to clipboard
fun ilog2Ceil(v: Int): Int
Link copied to clipboard
fun Double.isAlignedTo(alignment: Double): Boolean
fun Float.isAlignedTo(alignment: Float): Boolean
fun Int.isAlignedTo(alignment: Int): Boolean
fun Long.isAlignedTo(alignment: Long): Boolean

Returns whether this is multiple of alignment

Link copied to clipboard
fun Double.isAlmostEquals(other: Double, epsilon: Double = 1.0E-6): Boolean
fun Float.isAlmostEquals(other: Float, epsilon: Float = 1.0E-5f): Boolean
Link copied to clipboard
Link copied to clipboard
fun isEquivalent(a: Double, b: Double, epsilon: Double = 1.0E-4): Boolean
Link copied to clipboard
fun Int.isMultipleOf(multiple: Int): Boolean
fun Long.isMultipleOf(multiple: Long): Boolean
Link copied to clipboard
fun ln(v: Int): Int
Link copied to clipboard
fun log(v: Int, base: Int): Int
Link copied to clipboard
fun log10(v: Int): Int
Link copied to clipboard
fun log2(v: Int): Int
Link copied to clipboard
fun max(a: Double, b: Double, c: Double): Double
fun max(a: Float, b: Float, c: Float): Float
fun max(a: Int, b: Int, c: Int): Int
fun max(a: Double, b: Double, c: Double, d: Double): Double
fun max(a: Float, b: Float, c: Float, d: Float): Float
fun max(a: Int, b: Int, c: Int, d: Int): Int
fun max(a: Double, b: Double, c: Double, d: Double, e: Double): Double
fun max(a: Float, b: Float, c: Float, d: Float, e: Float): Float
fun max(a: Int, b: Int, c: Int, d: Int, e: Int): Int
Link copied to clipboard
Link copied to clipboard
fun min(a: Double, b: Double, c: Double): Double
fun min(a: Float, b: Float, c: Float): Float
fun min(a: Int, b: Int, c: Int): Int
fun min(a: Double, b: Double, c: Double, d: Double): Double
fun min(a: Float, b: Float, c: Float, d: Float): Float
fun min(a: Int, b: Int, c: Int, d: Int): Int
fun min(a: Double, b: Double, c: Double, d: Double, e: Double): Double
fun min(a: Float, b: Float, c: Float, d: Float, e: Float): Float
fun min(a: Int, b: Int, c: Int, d: Int, e: Int): Int
Link copied to clipboard
Link copied to clipboard

Returns the previous or next value of this that is multiple of align. If this is already multiple, returns itself.

Link copied to clipboard
fun Int.nextAlignedTo(align: Int): Int

Returns the next value of this that is multiple of align. If this is already multiple, returns itself.

Link copied to clipboard
fun Int.nextMultipleOf(multiple: Int): Int
fun Long.nextMultipleOf(multiple: Long): Long
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Int.numberOfDigits(radix: Int = 10): Int
fun Long.numberOfDigits(radix: Int = 10): Int
Link copied to clipboard
fun Int.prevAlignedTo(align: Int): Int

Returns the previous value of this that is multiple of align. If this is already multiple, returns itself.

Link copied to clipboard
fun Int.prevMultipleOf(multiple: Int): Int
fun Long.prevMultipleOf(multiple: Long): Long
Link copied to clipboard
Link copied to clipboard

Signs of the value. Zero will be converted into -1

Link copied to clipboard

Signs of the value. Zero will be converted into +1

Link copied to clipboard
fun Double.smoothstep(edge0: Double, edge1: Double): Double
Link copied to clipboard
fun sq(v: Double): Double
fun sq(v: Float): Float
fun sq(v: Int): Int
Link copied to clipboard
Link copied to clipboard
inline fun Byte.toBoolean(): Boolean
Link copied to clipboard
inline fun Boolean.toByte(): Byte
Link copied to clipboard
Link copied to clipboard
inline fun Boolean.toInt(): Int

Converts this Boolean into integer: 1 for true, 0 for false

Link copied to clipboard

Converts this into Int rounding to the ceiling

Link copied to clipboard
fun Long.toIntClamp(min: Int = Int.MIN_VALUE, max: Int = Int.MAX_VALUE): Int

Clamps this value into the range min and max converting it into Int. The default parameters will cover the whole range of values.

Link copied to clipboard

Converts this into Int rounding to the floor

Link copied to clipboard

Converts this into Int rounding to the nearest

Link copied to clipboard

Convert this Long into an Int but throws an IllegalArgumentException in the case that operation would produce an overflow

Link copied to clipboard

Converts this into Int rounding to the nearest

Link copied to clipboard
Link copied to clipboard
fun Long.toUintClamp(min: Int = 0, max: Int = Int.MAX_VALUE): Int

Clamps this value into the range min and max converting it into Int (where min must be zero or positive). The default parameters will cover the whole range of positive and zero values.

Link copied to clipboard
infix fun Double.umod(other: Double): Double
infix fun Int.umod(other: Int): Int

Performs the unsigned modulo between this and other (negative values would wrap)

infix fun Float.umod(other: Float): Float