Files
rippled/include
Pratik Mankawde 2c2b747881 fix: Correct the zero sentinel and narrow the equivalence claim
Two review findings on the static normalizeToRange documentation, both
confirmed against the code.

The documented zero result was wrong. doNormalize copies the canonical zero
out of a default-constructed Number, and Number's exponent_ is initialised to
std::numeric_limits<int>::lowest(), not 0. normalizeToRangeImpl returns that
exponent unchanged, so a zero mantissa yields {0, lowest()}.

The "bit-identical to the two-pass path" note was unconditionally false. At
exponent == kMinExponent the scale-up loop cannot run, so a mantissa below the
wider range's minimum falls into doNormalize's zero branch: building a Number
first collapses 10^17e-32768 to zero, while normalizing straight to the IOU
range scales down and returns {10^15, kMinExponent + 2}. The single pass is the
more accurate of the two, so the note is narrowed to the exponents IOUAmount
can actually reach rather than the code changed to reproduce the loss.

Add tests pinning both, since nothing covered a zero mantissa or the exponent
floor.
2026-09-23 15:41:00 +01:00
..