News for hackers. Stuff that matters.
Re:How to compare floats in Python by Tainnor on Thursday March 31, 2022 @05:22AM (#30865302)
I mean, he's using relative tolerance, not absolute. Most common arithmetic operations should be well behaved w.r.t. relative tolerance, unless you're using denormalised numbers.
Re:How to compare floats in Python by cdavid on Thursday March 31, 2022 @09:00AM (#30866679)
relative tolerance is not always enough, especially near 0. This classic article gives a nice overview of absolute, relative, ulp-based and other methods for comparison of float numbers: https://randomascii.wordpress.com/2012/02/25/comparing-float...
Re:How to compare floats in Python by Tainnor on Thursday March 31, 2022 @01:16PM (#30869775)
> especially near 0

Yes, these are denormalised numbers. They aren't as well behaved.