Exact rounding on a decimal coefficient grid #
IEEE 754-2019 §4.3 requires five rounding directions for decimal arithmetic. The integer decision below works on an exact rational magnitude. In particular, midpoints are compared exactly; no binary floating approximation is used. Format precision, exponent range, and cohort selection are handled separately.
The five IEEE 754-2019 §4.3 decimal rounding-direction attributes.
- nearestEven : RoundingMode
- nearestAway : RoundingMode
- towardZero : RoundingMode
- towardPositive : RoundingMode
- towardNegative : RoundingMode
Instances For
Instances For
Whether an inexact result should increase in magnitude at a given integer grid point.
remainder is the exact fractional part, between zero and one.
Instances For
Round a nonnegative exact rational magnitude to an integer coefficient. The sign affects the directed modes, including rounding a negative value to zero.
Instances For
Apply the sign after rounding; callers retain the separate sign for signed zero.
Instances For
Rounding on a decimal grid whose quantum is 10 ^ q.