Guarantees for significant-digit output #
The carry adjustment preserves value. The emitted characters therefore denote the result of the existing exact integer-grid rounder, with its nearest and directed error guarantees. The inexact flag detects a numerical change even when the requested precision changes the output quantum.
Every nonzero output coefficient has exactly the requested number of decimal digits.
The significant-digit result is one integer-grid rounding of the exact input.
Output retains the sign, including for zero.
Upward decimal output is an upper enclosure at every requested precision.
Downward decimal output is a lower enclosure at every requested precision.
Toward-zero decimal output does not increase magnitude.
At a midpoint, nearest-even output selects the even adjacent grid coefficient.
At a midpoint, nearest-away output selects the larger magnitude.
Enough requested digits preserve the exact numerical value in every rounding mode.
The descriptor precision suffices for every valid datum, with no restriction on exponent bias.
Both nearest modes have at most half a requested grid unit of error.
Actual output characters decode to the computed significant-digit record.
Requested-precision output sets inexact exactly when its character value differs from the input.
At least the format precision preserves numerical value through actual output and input. The two conversions may use different rounding modes; the quantum need not be recovered.
Sufficient-precision output raises none of the five IEEE flags.
Parsing sufficient-precision output raises no flags, even if its written quantum cannot fit.
Exact precision returns the representation-preserving spelling without flags.