benilla-re systems structs docs

_FloatOutStruct

struct · crt · 26 bytes

Meaning
Holds the decimal exponent, sign, digit count and digits I10_OUTPUT writes
Confidence
verified, proof one
Finding
crt/decimal#making-the-digits

Finding: Making the digits in crt: decimal digits

For a finite nonzero value, I10_OUTPUT estimates the decimal exponent r, scales the magnitude by 10^-r, and when that is 1 or more adds one to r and multiplies by 0.1 truncated to 80 bits. The digit count is ndigits, plus r with bit 0 of flags (then 0 or less is the zero), at most 21. It makes one digit more than the count, each the integer part of ten times the remaining fraction. A last digit of 5 or more adds one to the digit before it, nines carrying; a carry out of the first makes it 1 and raises the exponent. Otherwise trailing zeros go, and none left is the zero.

The derivation is in the doc.

Fields 4

offsetsizetypenamemeaningconfidencefinding
0x00002int16_texpHolds the decimal exponentverified, proof onecrt/decimal#making-the-digits
0x00021charsignHolds - for a set sign bit, else a spaceverified, proof onecrt/decimal#making-the-digits
0x00031uint8_tManLenHolds the number of digits keptverified, proof onecrt/decimal#making-the-digits
0x000422char[22]manHolds the digits, a NUL after the kept onesverified, proof onecrt/decimal#making-the-digits