Integer-to-decimal numerical contracts #
Integer sources are converted from their exact value, with preferred quantum zero. Every integer representable in the destination remains exact, including integers whose decimal representation requires a positive exponent. Other nonoverflowing results satisfy the decimal grid's error and direction bounds.
Custom descriptors may exclude quantum zero. Zero then takes the nearest
allowed quantum, and a coarse minimum quantum can make a nonzero integer
underflow. The standard presets satisfy the optional HasQuantumZero assumption.
Integer zero is exact and positive, with its preferred exponent clamped to the destination interval. This includes custom descriptors that exclude quantum zero.
When quantum zero is available, integer zero keeps that exponent and raises no flags.
Representability suffices for exact conversion; no coefficient-size restriction is imposed on the integer itself. Changing its cohort does not raise an exception.
A nearest conversion incurs at most half a unit on the selected decimal grid.
Inexact reports a numerical change, never a change of exponent alone.
For an arbitrary descriptor, underflow means a tiny exact integer input together with a numerical change. Coarse custom formats can therefore underflow on integers.
When quantum zero is available, integer sources cannot underflow: every integer below the normal range is exactly representable as an integer coefficient. Larger integers are not tiny. The least normal value need not be at most one.