Native floating point type, corresponding to the IEEE 754 binary32 format
(float
in C or f32
in Rust).
- val : float32Spec.float
Instances For
Equations
- a.lt b = match a, b with | { val := a }, { val := b } => float32Spec.lt a b
Instances For
Raw transmutation from UInt32
.
Float32s and UInts have the same endianness on all supported platforms. IEEE 754 very precisely specifies the bit layout of floats.
Raw transmutation to UInt32
.
Float32s and UInts have the same endianness on all supported platforms. IEEE 754 very precisely specifies the bit layout of floats.
Note that this function is distinct from Float32.toUInt32
, which attempts
to preserve the numeric value, and not the bitwise value.
Note: this is not reflexive since NaN != NaN
.
If the given float is non-negative, truncates the value to the nearest non-negative integer.
If negative or NaN, returns 0
.
If larger than the maximum value for UInt8
(including Inf), returns the maximum value of UInt8
(i.e. UInt8.size - 1
).
If the given float is non-negative, truncates the value to the nearest non-negative integer.
If negative or NaN, returns 0
.
If larger than the maximum value for UInt16
(including Inf), returns the maximum value of UInt16
(i.e. UInt16.size - 1
).
If the given float is non-negative, truncates the value to the nearest non-negative integer.
If negative or NaN, returns 0
.
If larger than the maximum value for UInt32
(including Inf), returns the maximum value of UInt32
(i.e. UInt32.size - 1
).
If the given float is non-negative, truncates the value to the nearest non-negative integer.
If negative or NaN, returns 0
.
If larger than the maximum value for UInt64
(including Inf), returns the maximum value of UInt64
(i.e. UInt64.size - 1
).
If the given float is non-negative, truncates the value to the nearest non-negative integer.
If negative or NaN, returns 0
.
If larger than the maximum value for USize
(including Inf), returns the maximum value of USize
(i.e. USize.size - 1
). This value is platform dependent).
Equations
- instToStringFloat32 = { toString := Float32.toString }
Obtains a Float32
whose value is near the given UInt32
. It will be exactly the value of the
given UInt32
if such a Float32
exists. If no such Float32
exists, the returned value will either
be the smallest Float32
this is larger than the given value, or the largest Float32
this is smaller
than the given value.
Obtains a Float32
whose value is near the given UInt64
. It will be exactly the value of the
given UInt64
if such a Float32
exists. If no such Float32
exists, the returned value will either
be the smallest Float32
this is larger than the given value, or the largest Float32
this is smaller
than the given value.
Obtains a Float32
whose value is near the given USize
. It will be exactly the value of the
given USize
if such a Float32
exists. If no such Float32
exists, the returned value will either
be the smallest Float32
this is larger than the given value, or the largest Float32
this is smaller
than the given value.
Equations
- instInhabitedFloat32 = { default := UInt64.toFloat32 0 }
Equations
- One or more equations did not get rendered due to their size.
Equations
- instHomogeneousPowFloat32 = { pow := Float32.pow }
Efficiently computes x * 2^i
.