Splits a number into the integer and fractional parts plus the printed length of each,
following Excel's display model: 15 significant digits shared between the two parts
(the formula-bar conversion, e.g. PI() → 3.14159265358979), trailing zeros stripped,
and rounding carried into the integer part. Rounding at the 15th significant digit is
also what absorbs binary float noise (0.1 + 0.2 → 0.3). Number-only (no string
round-trip) to stay fast on the render/measure path.
Intended for UI layout decisions (autofit measure, width fitting) — display text itself
comes from the number format engine. Two documented deviations from an exact
toPrecision(15) round-trip, both irrelevant at display width:
The fraction is capped at 15 printed digits so fp stays a safe integer, so values
below 0.1 spend budget on leading zeros and round away their last significant
digits. General renders those magnitudes in scientific notation anyway.
Within half a float ulp of a decimal rounding tie the last digit can go the other way.
Splits a number into the integer and fractional parts plus the printed length of each, following Excel's display model: 15 significant digits shared between the two parts (the formula-bar conversion, e.g.
PI()→3.14159265358979), trailing zeros stripped, and rounding carried into the integer part. Rounding at the 15th significant digit is also what absorbs binary float noise (0.1 + 0.2→0.3). Number-only (no string round-trip) to stay fast on the render/measure path.Intended for UI layout decisions (autofit measure, width fitting) — display text itself comes from the number format engine. Two documented deviations from an exact
toPrecision(15)round-trip, both irrelevant at display width:fpstays a safe integer, so values below0.1spend budget on leading zeros and round away their last significant digits. General renders those magnitudes in scientific notation anyway.