Quantize: range, fixed quantum, and numerical error #
The successful result has exactly the requested quantum, including signed zero. The coefficient is obtained by a single exact rational rounding on that grid. The range test is necessary and sufficient for a finite result.
Invalid is raised precisely when the requested rounded representation does not fit.
A successful quantization has the specified sign, grid, and rounded coefficient.
Quantize raises neither underflow nor overflow, even for inexact subnormal results.
Quantization to an already represented quantum preserves the entire finite datum.
The nearest-mode error uses the requested quantum, not a normalized precision grid.
On success the inexact flag records a numerical change, independently of the sign.
Every rounding direction changes the value by less than one requested grid unit.
Upward quantization is an upper bound on the exact input value, for either sign.
Downward quantization is a lower bound on the exact input value, for either sign.