3 ms·
Maybe creating a standard textual hexadecimal-double format could be a good middle ground. "a.2aE3b" easy to include in text and to parse and maybe easy to read
by Rexxar 5y ago
Maybe creating a standard textual hexadecimal-double format could be a good middle ground. "a.2aE3b" easy to include in text and to parse and maybe easy to read once used to it.
hex => dec
a.8 => 10.5
f.88 => 15.55
9.e => 9.875
11.8 => 17.5
a.8E1 => 168 (15.5*16)
a.8E2 => 2688 (15.5*16^2)
- willis936 5y agoRather than constraining to floating point, why not just use a 4-bit BCD format with a zeros place symbol and terminator symbol? That way you can express exact values efficiently. Of course it becomes unwieldy when specifying extreme values (such as 10^100), but for most reasonable values (10^20 to 10^-20) it beats both floating point and ASCII for size and speed.