News for hackers. Stuff that matters.
Re:Counting Bugs in Windows Calculator by scscsc on Wednesday March 13, 2019 @01:07AM (#19375903)
Still, the comparison ratio == threshold has very little chance to turn out true.

When you want to check whether A >= B (where A and B are numbers represented as floats), you would probably want to use the check A >= B - epsilon.

Re:Counting Bugs in Windows Calculator by melkiaur on Wednesday March 13, 2019 @04:22AM (#19376738)
I disagree strongly. It looks obvious to me that they can be equal and that this is a special case. The comparison is done only after checking for A<B, and only if a boolean called "ActiveIfEqual" is true. I mean, I don't know how much more obvious they could have made it.
Re:Counting Bugs in Windows Calculator by benj111 on Wednesday March 13, 2019 @05:21AM (#19377032)
All edge cases have very little chance of being true, and I would hazard a guess that most of a developers time, and most code is spent on edge cases.

So I'm not sure you can argue against a piece of code on the basis of likelihood.

Re:Counting Bugs in Windows Calculator by geofft on Wednesday March 13, 2019 @01:28AM (#19375981)
It only has little chance to turn out true if they're calculated in different ways and accumulate different error. If you're e.g. dividing two pairs of integers and comparing them, regular equality is likely to be fine.

A relevant question is what epsilon should be.