3 ms·
So.. Can someone better versed in the ways of system level programming tell me why we still use IEEE 754 exponential notation? Iv'e seen article after article
by crankylinuxuser 8y ago
So.. Can someone better versed in the ways of system level programming tell me why we still use IEEE 754 exponential notation?
Iv'e seen article after article of how "horrible it is". So, are there default libs to use Binary Coded Decimal (BCD) or something like that?
- TazeTSchnitzel 8y agoWe use it because it's fast, accurate and very useful for many applications. It's not horrible.
- chowells 8y agoIn fact, as discussed in another thread, it's the optimal representation for many purposes. The only problems are that some languages over-privilege them to the point where it's difficult to use alternatives, and some programmers don't understand them.
- ori_b 8y agoBecause ever other alternative is either variable size (which implies allocations, making itb orders of magnitude slower), or has the same problems, just in different places.
- aidenn0 8y agoBinary floating points are not for system level programming; they are for scientific programming, where the accuracy of the values is related to the magnitude of the values. 64 bit integers are actually good for a lot of things that floating point gets used for; coordinates already should never have been floating point (the accuracy of measurement is independent of the magnitude for coordinates), but you could represent the entire solar system in millimeters without overflowing 64 bit integers (compared to not even the entire earth in mm for 32 bit integers). Also, it's popular to blame javascript for all today's problems, but the double-precision floating point is the only number type it has, which has some effect on its use.
- Retra 8y agoYou need a fixed data size for good performance. If you use fixed precision, you get absolute nonsense when doing very common calculations like `tan(x)`. IEEE 754 was masterfully engineered to produce the fastest, most correct results for the most common operations. We use it because it's fantastic.