Scoop API

scoop:scoop.core:0.1.0

Float

struct Float

source · line 7
public
public 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

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
public
@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
public
@NoGC @Intrinsic("float_unary_minus")
    public override operator fun unaryMinus(): Float

Flips the sign bit, including for zero and NaN.

function minus

source · line 115
public
@NoGC @Intrinsic("float_minus")
    public override operator fun minus(other: Float): Float

Subtracts at the receiver's precision using IEEE rounding and non-finite results.

function toULong

source · line 229
public
@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
public
@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.

function toLong

source · line 205
public
@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
public
@NoGC @Intrinsic("float_equals")
    public override operator fun equals(other: Float): Boolean

Compares numerical values, treating all NaNs as one equal class and both signed zeros as equal.

function compareTo

source · line 168
public
@NoGC @Intrinsic("float_compare_to")
    public override operator fun compareTo(other: Float): Long

Returns -1, 0, or 1 in numerical order, with all NaNs equal and after positive infinity; signed zeros compare equally.

function isNaN

source · line 149
public
@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
public
@NoGC @Intrinsic("float_times")
    public override operator fun times(other: Float): Float

Multiplies at the receiver's precision using IEEE rounding and non-finite results.

function toShort

source · line 193
public
@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 250
public
public override fun toString(): String

Returns a locale-independent shortest round-tripping decimal representation, or the corresponding NaN/infinity spelling.

function toByte

source · line 187
public
@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
public
@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
public
@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
public
@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
public
@NoGC @Intrinsic("float_unary_plus")
    public override operator fun unaryPlus(): Float

Returns the same floating-point representation, preserving signed zero and NaN bits.

function toUShort

source · line 217
public
@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
public
@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
public
@NoGC @Intrinsic("float_is_infinite")
    public fun isInfinite(): Boolean

Returns true for positive or negative infinity.

function toInt

source · line 199
public
@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
public
@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
public
@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.

function div

source · line 128
public
@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.

function toBits

source · line 77
public
@NoGC
    public fun toBits(): Int

Returns the raw representation bits, preserving signed zeros and NaN payloads.

function toUByte

source · line 211
public
@NoGC @Intrinsic("float_to_uint8")
    public fun toUByte(): UByte

Truncates toward zero and saturates to the 8-bit unsigned range. NaN becomes zero.