Exponent-operation contracts #
scale changes the exact binary exponent before rounding, and binaryExponent reports the
leading binary exponent. The finite contracts reduce each operation to the shared dyadic rounder
and status calculation. Zero, infinity, and NaNs have their own equations.
A finite nonzero input delivers its exact leading exponent without any exception.
The integer answer brackets the exact finite magnitude between consecutive powers of two.
The exceptional integer is strictly beyond the IEEE integer-result bound in either sign.
An integer-result exponent query signals invalid on zero, rather than divide-by-zero.
Either infinity uses the positive exceptional integer and signals invalid.
Both quiet and signaling NaNs signal invalid for an integer-result exponent query.
Scaling with status := true delivers the value of scaling.
On finite input, scale changes only the exact binary exponent before rounding.
Scaling by zero uses the ordinary one-round exact-dyadic path.
scale returns either infinity unchanged and raises no exception.
scale quiets a NaN and raises invalid exactly for a signaling NaN.
binaryExponent with status := true delivers the value of binaryExponent.
For a nonzero finite dyadic ±m * 2^e with m > 0, binaryExponent returns the rounded
encoding of the integer floor(log₂ m) + e.
binaryExponent of finite zero raises divideByZero and returns nativeOverflow fmt true.
For IEEE encodings that value is negative infinity, as IEEE 754-2019 §5.3.3 requires. For the
finiteMaxNaN and finiteUnsignedZero encodings, which have no infinity, it is the encoding's
NaN word, with the same divideByZero flag for the zero input. The finite encoding saturates to
its most negative finite value. The ternary value compares that delivery with the exact -∞.
binaryExponent of either infinity returns nativeOverflow fmt false and raises no exception.
For IEEE encodings this is positive infinity. The ternary value compares that delivery with the
exact +∞.
binaryExponent quiets a NaN and raises invalid exactly for a signaling NaN.