abhi9u@lemmy.world to Technology@lemmy.worldEnglish · 2 年前How Python Compares Floats and Ints: When Equals Isn’t Really Equalblog.codingconfessions.comexternal-linkmessage-square42linkfedilinkarrow-up1141arrow-down19
arrow-up1132arrow-down1external-linkHow Python Compares Floats and Ints: When Equals Isn’t Really Equalblog.codingconfessions.comabhi9u@lemmy.world to Technology@lemmy.worldEnglish · 2 年前message-square42linkfedilink
minus-squaremagic_lobster_party@kbin.runlinkfedilinkarrow-up16·2 年前It’s both. As you said it’s because of loss of floating point precision, but it’s also with some of the quirks how Python compares int with float. These two together causes this strange behavior.
It’s both. As you said it’s because of loss of floating point precision, but it’s also with some of the quirks how Python compares int with float. These two together causes this strange behavior.