Exponent-operation contracts #
scaleB changes an exact binary exponent before one rounding step; logB reports the leading
binary exponent. The finite contracts reduce each operation to the shared dyadic rounder and
status calculation. Separate equations give the value and flags for zero, infinity, and NaNs.
scaleB is exactly the value component of its status-bearing operation.
On finite input, scaleB changes only the exact power-of-two exponent before the one selected
rounding operation.
Scaling by zero uses the ordinary one-round exact-dyadic path.
scaleB preserves either infinity and raises no exception.
scaleB quiets a NaN and raises invalid exactly for a signaling NaN.
logB is exactly the value component of its status-bearing operation.
For a nonzero finite dyadic ±m * 2^e with m > 0, logB returns the rounded encoding of the integer
floor(log₂ m) + e.
logB 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.
logB of either infinity returns nativeOverflow fmt false and raises no exception.
For IEEE encodings this is positive infinity.
logB quiets a NaN and raises invalid exactly for a signaling NaN.