@abhi9u to TechnologyEnglish • 7 months agoHow Python Compares Floats and Ints: When Equals Isn’t Really Equalblog.codingconfessions.comexternal-linkmessage-square43arrow-up1143arrow-down19cross-posted to: [email protected]
arrow-up1134arrow-down1external-linkHow Python Compares Floats and Ints: When Equals Isn’t Really Equalblog.codingconfessions.com@abhi9u to TechnologyEnglish • 7 months agomessage-square43cross-posted to: [email protected]
minus-square@SylvartaslinkEnglish4•7 months agoThat makes sense, but then you’d just have people converting the int to a float manually and run into the exact same issues.
minus-square🇦🇺𝕄𝕦𝕟𝕥𝕖𝕕𝕔𝕣𝕠𝕔𝕕𝕚𝕝𝕖linkfedilinkEnglish5•7 months agoI mean honestly its expected u should check floats similarity not equivalence.
minus-square@SylvartaslinkEnglish4•7 months agoAgreed. But the less experienced programmers I know are surprisingly naive about this.
minus-square🇦🇺𝕄𝕦𝕟𝕥𝕖𝕕𝕔𝕣𝕠𝕔𝕕𝕚𝕝𝕖linkfedilinkEnglish3•7 months agoYeah its gonna be one of those problems chatgpt ain’t gonna help
minus-square@[email protected]linkfedilinkEnglish2•7 months agoThey wouldn’t be running into an issue, but creating one, that’s different
minus-square@SylvartaslinkEnglish1•7 months agoMeh. Imo anyone comparing an integer to a float and not expecting one of them to be implicitly casted to the other’s type will create that issue for themselves when doing the same thing with an explicit cast.
minus-square@[email protected]linkfedilinkEnglish3•7 months agoWhat I meant is, the former can be a genuine mistake, the latter is a conscious (probably uneducated) decision
That makes sense, but then you’d just have people converting the int to a float manually and run into the exact same issues.
I mean honestly its expected u should check floats similarity not equivalence.
Agreed. But the less experienced programmers I know are surprisingly naive about this.
Yeah its gonna be one of those problems chatgpt ain’t gonna help
They wouldn’t be running into an issue, but creating one, that’s different
Meh. Imo anyone comparing an integer to a float and not expecting one of them to be implicitly casted to the other’s type will create that issue for themselves when doing the same thing with an explicit cast.
What I meant is, the former can be a genuine mistake, the latter is a conscious (probably uneducated) decision