News for hackers. Stuff that matters.
Re:How to compare floats in Python by jsmith45 on Wednesday March 30, 2022 @01:48PM (#30858471)
Decimal representations have one really minor advantage: they behave more the way people expect with respect to which numbers are exactly representable especially in the size ranges of every-day numbers, since they exhibit mostly the same behavior as calculators do.

Plenty of people find that 0.2 not being exactly representable in binary floating point is not intuitive.

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...