Rounding to a specified decimal quantum #
IEEE 754-2019 §5.3.2 specifies quantize independently of ordinary projection: the target quantum is fixed, and a coefficient that does not fit produces invalid instead of changing that quantum. Underflow and overflow flags are never raised.
def
FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.quantizeMagnitude
(f : Format)
(mode : RoundingMode)
(s : Bool)
(x : ℚ)
(q : ℤ)
:
Round a nonnegative magnitude to a fixed quantum, retaining the supplied sign. An invalid quantum or an oversized rounded coefficient produces a quiet NaN.
Instances For
def
FloatLib.Floats.Formats.DecimalInterchange.Arithmetic.quantize
(f : Format)
(mode : RoundingMode)
:
Quantize the first operand to the second operand's quantum. The second operand's sign and coefficient do not affect a finite result.