_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
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 2 | int16_t | exp | Holds the decimal exponent | verified, proof one | crt/decimal#making-the-digits |
0x0002 | 1 | char | sign | Holds - for a set sign bit, else a space | verified, proof one | crt/decimal#making-the-digits |
0x0003 | 1 | uint8_t | ManLen | Holds the number of digits kept | verified, proof one | crt/decimal#making-the-digits |
0x0004 | 22 | char[22] | man | Holds the digits, a NUL after the kept ones | verified, proof one | crt/decimal#making-the-digits |