Re:How to compare floats in Python
by colejohnson66 on Thursday March 31, 2022 @09:37AM
(#30867020)
IEEE-754 allows "decimal floats". Basically, instead of 2^exponent, it's 10^exponent. `decimal32`[0], `decimal64`[1], and `decimal128`[2] are defined. But I'm not aware of any popular system that implements them.
[0]: https://en.wikipedia.org/wiki/Decimal32_floating-point_forma...
[1]: https://en.wikipedia.org/wiki/Decimal64_floating-point_forma...
[2]: https://en.wikipedia.org/wiki/Decimal128_floating-point_form...
Plenty of people find that 0.2 not being exactly representable in binary floating point is not intuitive.