SplitScript reference / f32
f32
Built-in type
f32
Stores a 32-bit floating-point number.
Floating-point values are useful for game coordinates, timers, and duration conversion. Decimal exponents and finite subnormal values are supported; target-width underflow and overflow are diagnosed.
Examples
Use f32
let smallestPositive: f32 = 1e-45
Capabilities
| Member | Description | Available through |
|---|---|---|
| Float | Identifies floating-point types. | |
| MemoryReadable | Supports deserialization from process memory. |
Operators
| Member | Description | Available through |
|---|---|---|
| == | Reports whether this value and another value are equal. | Available through Equatable |
| != | Reports whether this value and another value differ. | Available through Equatable |
| + | Adds another value of the same numeric type. | Available through Numeric |
| / | Divides by another value of the same numeric type. | Available through Numeric |
| * | Multiplies by another value of the same numeric type. | Available through Numeric |
| - | Subtracts another value of the same numeric type. | Available through Numeric |
| - | Returns this value with its sign inverted. | Available through Signed |
Methods
| Member | Description | Available through |
|---|---|---|
| debugString | Converts the receiver to its unambiguous structural representation. | Available through Debug |
| toString | Converts the receiver to its user-facing string representation. | Available through Display |
| ceil | Rounds up to the nearest integral value. | Available through Float |
| floor | Rounds down to the nearest integral value. | Available through Float |
| isFinite | Returns whether the receiver is neither infinity nor NaN. | Available through Float |
| isNaN | Returns whether the receiver is the floating-point not-a-number value. | Available through Float |
| round | Rounds to the nearest integral value, with halfway values rounded to even. | Available through Float |
| roundTo | Rounds to a requested number of digits after the decimal point. | Available through Float |
| sqrt | Returns the principal square root of this value. | Available through Float |
| truncate | Rounds this value toward zero to an integral value. | Available through Float |
| clamp | Restricts a numeric value to an inclusive range. | Available through Numeric |
| max | Returns the larger of two numeric values. | Available through Numeric |
| min | Returns the smaller of two numeric values. | Available through Numeric |
| squared | Multiplies this value by itself. | Available through Numeric |
| swapBytes | Reverses the order of the bytes in this numeric value. | Available through Numeric |
| abs | Returns this value without a negative sign. | Available through Signed |
| NaN | The canonical 32-bit not-a-number value. | |
| fromBits | Constructs a 32-bit float from its exact IEEE-754 bit pattern. | |
| negativeInfinity | Negative infinity as a 32-bit floating-point value. | |
| positiveInfinity | Positive infinity as a 32-bit floating-point value. | |
| toBits | Returns this float's exact IEEE-754 bit pattern. |