CAM-Gerlach
(C.A.M. Gerlach)
March 20, 2023, 11:10am
36
It seems to me that this particular concern is getting a little off topic for this thread (about floordiv), and rather essentially the same as the one addressed in the previous 1e23
ones (that unfortunately mostly devolved into dumpster fires), which is a separate issue.
Let int accept scientific notation strings, like float does (but with non-negative exponents only). This would allow scientific notation strings (e.g., command-line arguments specifying big integers) to be parsed directly without the loss of precision incurred by converting via float (e.g., int(float('1e23')) != 10**23).
Human beings know that
100000000000000000000000.0
1.0e+23
are integers. They are in the group of real numbers, but they are also in the integer group.
My idea is to represent internally these numbers as a new internal type. Temporary name: PyFloatLongObject.
Integers have “infinite” precision. So, 1e23 == 10 ** 23 is False now.
If 1e23 will be internally a PyFloatLongObject, 1e23 == 10 ** 23 will become True.
This behavior can be restricted to only big integers, to not slow down little fl…