Re:How to compare floats in Python
by cuteboy19 on Wednesday March 30, 2022 @01:05PM
(#30857917)
We need a little bit of background for this. In Java the == operator checks if two variables are pointing to the same object. The .equals() method checks for actual value equality.
Except for primitives like ints and floats where == does value comparison.
For NaN the value comparison is false. Even then .equals returns true
[ Parent
| on HN ]
There are no comments on this comment yet.