[issue39436] Strange behavior of comparing int and float numbers

2020-01-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: Further to what Matthew said, this is not just a Python oddity. It applies to just about all programming languages, including C, C++, Java, Javascript, Ruby, etc. Some of them have even less precision by default. Floats are not the same as the real numbers

[issue39436] Strange behavior of comparing int and float numbers

2020-01-23 Thread Matthew Barnett
Change by Matthew Barnett : -- stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39436] Strange behavior of comparing int and float numbers

2020-01-23 Thread Matthew Barnett
Matthew Barnett added the comment: Python floats have 53 bits of precision, so ints larger than 2**53 will lose their lower bits (assumed to be 0) when converted. -- nosy: +mrabarnett resolution: -> not a bug ___ Python tracker

[issue39436] Strange behavior of comparing int and float numbers

2020-01-23 Thread Petr Pisl
New submission from Petr Pisl : When python compares float and int created from the same int number should be equal like int(1) == float(1) but from 9007199254740993 this is not true. int(9007199254740993) == float(9007199254740993) is not true. The same behavior is for bigger odd