News for hackers. Stuff that matters.
Re:How to compare floats in Python by eru on Thursday March 31, 2022 @07:59PM (#30873666)
Alas, addition isn't well-behaved.

Eg when you want to add a list of (non-negative) numbers, it makes a difference what order you add them in. The usual recommendation is to add them in ascending order.

Re:How to compare floats in Python by Tainnor on Friday April 01, 2022 @01:00PM (#30880486)
It's not commutative, yes, but it should still obey the property that the relative error terms add instead of multiplying, no?

(i.e. in the parent's case of "checking that, if you add a bunch of disjoint probabilities, they're at most 1", doing that with approximate equality seems fine to me?)