benilla-re systems structs docs

s_savedNumberFormat

global · ui

Address
0x872e28 · 6 bytes, up to 0x872e2d
Type
char[6]
Meaning
Holds %.16g, the format of a saved number
Confidence
verified, proof two
Finding
ui/savedvariables#saved-numbers

Finding: Saved numbers in ui: saved variables

A finite number is written as %.16g by SStrPrintf, which passes the spec unchanged to _snprintf. The g form takes 17 digits from I10_OUTPUT, rounded on an 18th and made with a 96-bit product and a truncated 0.1, not from the value's exact digits (crt/decimal), and rounds them to 16 on the 17th, a next digit of 5 or more rounding the magnitude up each time. So the exact digits rounded twice miss cases; 1234567890123456.5 is written 1234567890123457. X, the rounded digits' decimal exponent less one, below -4 or of 16 or more takes the e form with a signed three-digit exponent (1e+016), else the f form (0.0001); trailing fraction zeros go, and a bare point. -0 is 0.

The derivation is in the doc.