Returns an Int that is close to the given (sign, mantissa, exponent) triple. Specifically, we
round to zero rather than rounding to nearest like we do everywhere else.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Converts an UnpackedFloat to an Int, sending NaN to 0 and positive and negative
infinity to the given values.
Equations
- Float.Model.UnpackedFloat.toInt negativeInfinity positiveInfinity Float.Model.UnpackedFloat.notANumber = 0
- Float.Model.UnpackedFloat.toInt negativeInfinity positiveInfinity (Float.Model.UnpackedFloat.infinity Float.Model.UnpackedFloat.Sign.positive) = positiveInfinity
- Float.Model.UnpackedFloat.toInt negativeInfinity positiveInfinity (Float.Model.UnpackedFloat.infinity Float.Model.UnpackedFloat.Sign.negative) = negativeInfinity
- Float.Model.UnpackedFloat.toInt negativeInfinity positiveInfinity (Float.Model.UnpackedFloat.zero sign) = 0
- Float.Model.UnpackedFloat.toInt negativeInfinity positiveInfinity (Float.Model.UnpackedFloat.finite s m e mantissa_pos) = Float.Model.UnpackedFloat.roundToInt s m e
Instances For
Converts an UnpackedFloat to a UInt8, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
- f.toUInt8 = UInt8.ofNatClamp (Float.Model.UnpackedFloat.toInt 0 (↑UInt8.size - 1) f).toNat
Instances For
Converts an UnpackedFloat to a UInt16, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
- f.toUInt16 = UInt16.ofNatClamp (Float.Model.UnpackedFloat.toInt 0 (↑UInt16.size - 1) f).toNat
Instances For
Converts an UnpackedFloat to a UInt32, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
- f.toUInt32 = UInt32.ofNatClamp (Float.Model.UnpackedFloat.toInt 0 (↑UInt32.size - 1) f).toNat
Instances For
Converts an UnpackedFloat to a UInt64, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
- f.toUInt64 = UInt64.ofNatClamp (Float.Model.UnpackedFloat.toInt 0 (↑UInt64.size - 1) f).toNat
Instances For
Converts an UnpackedFloat to a USize, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
- f.toUSize = USize.ofNatClamp (Float.Model.UnpackedFloat.toInt 0 (↑USize.size - 1) f).toNat
Instances For
Converts an UnpackedFloat to an Int8, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
Instances For
Converts an UnpackedFloat to an Int16, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
Instances For
Converts an UnpackedFloat to an Int32, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
Instances For
Converts an UnpackedFloat to an Int64, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.
Equations
Instances For
Converts an UnpackedFloat to an ISize, truncating after the decimal point, sending NaN to
0 and clamping out-of-range values and infinities.