struct Float
source · line 7public struct Float : Add<Float, Float>, Sub<Float, Float>, Mul<Float, Float>, Div<Float, Float>, Rem<Float, Float>, UnaryPlus<Float>, UnaryMinus<Float>, Increment<Float>, Decrement<Float>, Equals<Float>, Compare<Float>, ToString
- Supertype
Add<Float, Float> - Supertype
Sub<Float, Float> - Supertype
Mul<Float, Float> - Supertype
Div<Float, Float> - Supertype
Rem<Float, Float> - Supertype
UnaryPlus<Float> - Supertype
UnaryMinus<Float> - Supertype
Increment<Float> - Supertype
Decrement<Float> - Supertype
Equals<Float> - Supertype
Compare<Float> - Supertype
ToString
IEEE 754 binary32 floating-point values, including infinities, signed zero, and NaNs. Default equality treats all NaNs as equal and both zeros as equal; ieeeCompare provides unordered IEEE comparison. Arithmetic uses round-to-nearest, ties-to-even.
function toDouble
source · line 243@NoGC @Intrinsic("float_to_double")
public fun toDouble(): Double
Converts to binary64. Every finite Float value is represented exactly; a zero keeps its sign.
function unaryMinus
source · line 91@NoGC @Intrinsic("float_unary_minus")
public override operator fun unaryMinus(): Float
- Overrides
unaryMinus· UnaryMinus
Flips the sign bit, including for zero and NaN.
function minus
source · line 115@NoGC @Intrinsic("float_minus")
public override operator fun minus(other: Float): Float
- Overrides
minus· Sub
Subtracts at the receiver's precision using IEEE rounding and non-finite results.
parameter other
source · line 116other: Float
function ieeeCompare
source · line 175@NoGC
public fun ieeeCompare(other: Float): IeeeComparison
Returns IeeeComparison.Unordered if either operand is NaN; otherwise compares numerical values with both zeros equal.
parameter other
source · line 176other: Float
function toULong
source · line 229@NoGC @Intrinsic("float_to_ulong")
public fun toULong(): ULong
Truncates toward zero and saturates to the 64-bit unsigned range. NaN becomes zero.
function plus
source · line 109@NoGC @Intrinsic("float_plus")
public override operator fun plus(other: Float): Float
- Overrides
plus· Add
Adds at the receiver's precision using IEEE rounding and non-finite results.
parameter other
source · line 110other: Float
function toLong
source · line 205@NoGC @Intrinsic("float_to_long")
public fun toLong(): Long
Truncates toward zero and saturates to the 64-bit signed range. NaN becomes zero.
function equals
source · line 142@NoGC @Intrinsic("float_equals")
public override operator fun equals(other: Float): Boolean
- Overrides
equals· Equals
Compares numerical values, treating all NaNs as one equal class and both signed zeros as equal.
parameter other
source · line 143other: Float
function compareTo
source · line 168@NoGC @Intrinsic("float_compare_to")
public override operator fun compareTo(other: Float): Long
- Overrides
compareTo· Compare
Returns -1, 0, or 1 in numerical order, with all NaNs equal and after positive infinity; signed zeros compare equally.
parameter other
source · line 169other: Float
function isNaN
source · line 149@NoGC @Intrinsic("float_is_nan")
public fun isNaN(): Boolean
Tests whether the value has any NaN representation. Default self-inequality is not a NaN test.
function times
source · line 121@NoGC @Intrinsic("float_times")
public override operator fun times(other: Float): Float
- Overrides
times· Mul
Multiplies at the receiver's precision using IEEE rounding and non-finite results.
parameter other
source · line 122other: Float
function toShort
source · line 193@NoGC @Intrinsic("float_to_int16")
public fun toShort(): Short
Truncates toward zero and saturates to the 16-bit signed range. NaN becomes zero.
function toString
source · line 250public override fun toString(): String
- Overrides
toString· ToString
Returns a locale-independent shortest round-tripping decimal representation, or the corresponding NaN/infinity spelling.
function toByte
source · line 187@NoGC @Intrinsic("float_to_int8")
public fun toByte(): Byte
Truncates toward zero and saturates to the 8-bit signed range. NaN becomes zero.
function dec
source · line 103@NoGC @Intrinsic("float_dec")
public override operator fun dec(): Float
- Overrides
dec· Decrement
Subtracts one at the receiver's floating-point precision.
function toFloat
source · line 236@NoGC @Intrinsic("float_to_float")
public fun toFloat(): Float
Converts to binary32 with nearest-even rounding. Overflow may produce infinity; a zero keeps its sign.
function isFinite
source · line 161@NoGC @Intrinsic("float_is_finite")
public fun isFinite(): Boolean
Returns true for finite values, including subnormal values and both zeros.
function unaryPlus
source · line 85@NoGC @Intrinsic("float_unary_plus")
public override operator fun unaryPlus(): Float
- Overrides
unaryPlus· UnaryPlus
Returns the same floating-point representation, preserving signed zero and NaN bits.
function toUShort
source · line 217@NoGC @Intrinsic("float_to_uint16")
public fun toUShort(): UShort
Truncates toward zero and saturates to the 16-bit unsigned range. NaN becomes zero.
function inc
source · line 97@NoGC @Intrinsic("float_inc")
public override operator fun inc(): Float
- Overrides
inc· Increment
Adds one at the receiver's floating-point precision.
function isInfinite
source · line 155@NoGC @Intrinsic("float_is_infinite")
public fun isInfinite(): Boolean
Returns true for positive or negative infinity.
function toInt
source · line 199@NoGC @Intrinsic("float_to_int")
public fun toInt(): Int
Truncates toward zero and saturates to the 32-bit signed range. NaN becomes zero.
function toUInt
source · line 223@NoGC @Intrinsic("float_to_uint")
public fun toUInt(): UInt
Truncates toward zero and saturates to the 32-bit unsigned range. NaN becomes zero.
function rem
source · line 135@NoGC @Intrinsic("float_rem")
public override operator fun rem(other: Float): Float
- Overrides
rem· Rem
Computes the remainder using a quotient truncated toward zero. Invalid operations produce NaN.
parameter other
source · line 136other: Float
function div
source · line 128@NoGC @Intrinsic("float_div")
public override operator fun div(other: Float): Float
- Overrides
div· Div
Performs IEEE division; zero divisors produce infinity or NaN rather than an integer arithmetic exception.
parameter other
source · line 129other: Float
function toBits
source · line 77@NoGC
public fun toBits(): Int
Returns the raw representation bits, preserving signed zeros and NaN payloads.
function toUByte
source · line 211@NoGC @Intrinsic("float_to_uint8")
public fun toUByte(): UByte
Truncates toward zero and saturates to the 8-bit unsigned range. NaN becomes zero.