New submission from Nicolas Primeau: Converting arbitrarily large float type numbers to integer type number results in a non trivially different number.
This can be repeated in all Python versions, same with Python 2 with longs. Expected behaviour would be an integer representation of 1e+44, and some_number == int_version. Example: >>> some_number = 100000000000000000000000000000000000000000000 >>> type(some_number) <class 'int'> >>> float_version = float(some_number) >>> float_version 1e+44 >>> type(float_version) <class 'float'> >>> int_version = int(float_version) >>> type(int_version) <class 'int'> >>> int_version 100000000000000008821361405306422640701865984 >>> int_version == some_number False >>> int_version == float_version True ---------- components: Interpreter Core messages: 252642 nosy: Nicolas Primeau priority: normal severity: normal status: open title: Unexpected behaviour when converting large float to int type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25358> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com