4 ms·
OK, I'll whack the hornets' nest here: Base 10 Arithmetic should be the standard, with others being available only when wise programmers explicitly choose it b
by dublin 4y ago
OK, I'll whack the hornets' nest here: Base 10 Arithmetic should be the standard, with others being available only when wise programmers explicitly choose it because they have a good reason.
Every tangle I've ever had with IEEE 754 would have been unnecessary if our computers and languages used the same numbers that humans do! (And we have way more than enough compute power now to make Base10 arithmetic the default - I'll cut the folks in the '60s some slack due to resource limits, but why are we still dealing with this brokenness in the 21st century?)
- xeonmc 4y agoI disagree: instead humans should drop base-10 entirely everywhere and use base-2 or base-16 instead.
- an1sotropy 4y ago"IEEE754" is ubiquitous because it was the first non-platform-specific solution to a fundamentally hard engineering problem (how to approximate the entire real number line with a finite number of bits), and because it is supported in hardware (on the CPU itself), so that the representation of the number fits within the same registers as used for pointers, integers, and everything else, which makes it fast. If you want base-10 encoding of non-integer values, and base-10 arithmetic on them, you're probably going to need a software library like [1], which implements the decimal math that is also in IEEE754, just not part of common hardware. It also may be that you actually want infinite-precision arithmetic, which definitely requires a library, because the representation of a number becomes its own dynamic data structure (like with a string). Can you say more about what exactly is the "brokenness" that you're running up against? [1] https://www.intel.com/content/www/us/en/developer/articles/tool/intel-decimal-floating-point-math-library.html https://www.intel.com/content/www/us/en/developer/articles/t...
- GoblinSlayer 4y agoIEEE 754 does define decimal types in addition to binary ones.