Decimal-to-binary conversion contracts #
Finite decimal inputs are evaluated as exact rationals, independently of their
cohort. Nearest-even conversion refines binary rounded-real semantics, and nearest-away
conversion has the integer-grid semantics proved in NearestAwayProof.
The directed conversions inherit the binary kernels' extended-real enclosure
bounds, which include overflow to infinity.
Exception theorems state the overflow and tininess predicates, including the distinction between exponent overflow and an inexact result at the largest finite value.
The source cohort affects neither the rounded binary value, its flags, nor its ternary value.
An infinity keeps its sign and raises no exception.
A signaling NaN raises invalid and a quiet NaN does not. Both deliver the quiet NaN
of binaryNaN and raise no other flag.
Zero magnitude rounds to the binary zero of sign s in every mode.
Finite nearest-even rational conversion equals binary rounded-real semantics.
Nearest-even conversion of a finite decimal input is one binary rounding of its value, provided the delivered result is finite.
Nearest-away conversion of a finite decimal input with a finite result delivers its rounded dyadic on the destination grid, so the encoder adds no second rounding.
Upward rational conversion encloses the exact input, including an infinite result.
Downward rational conversion encloses the exact input, including an infinite result.
Conversion toward positive infinity is an extended-real upper bound.
Conversion toward negative infinity is an extended-real lower bound.
A positive decimal input rounded toward zero does not increase.
A negative decimal input rounded toward zero does not decrease.
A finite decimal input cannot raise invalid during numeric conversion.
Numeric conversion cannot raise division-by-zero.
The finite conversion path raises overflow exactly at the mode's rational boundary.
Inexact means exponent overflow or a changed exact rational value.
Underflow is an inexact tiny result without exponent overflow. Tininess is measured after rounding to the destination precision with an unbounded exponent range.