|
|
|
|
|
by antonyme
2539 days ago
|
|
Very few developers truly understand floating point representation. Most think of it as base-10, and put in horrific kludges and workarounds when they discover it doesn't work as they (wrongly) expected. I shudder to think how many e-commerce sites use `float` for financial transactions! So as far as I'm concerned, whatever performance cost these alternate methods may have, it would be well worth it to avoid the pitfalls of IEEE floats. Intel chips have had BCD support in machine code; I'm surprised nobody has made a decent fixed point lib that is widely used already. |
|
If you don't care about performance, then the actual solution has no dependency on hardware:
1. Replace the default format for numbers with a decimal point in suitably high level languages with a infinite precision format.
2. Teach people using other languages about floating point and how they may want to use integers instead.
The end. No multi-generation hardware transition required.
IMO, IEEE 754 is an exceptionally good format. It has real problems, but they aren't widely known to people unfamiliar with floats (e.g. 1.0 + 2.0 != 3.0 isn't one of them).