Tim Peters <t...@python.org> added the comment:

Arguments to `remainder()` are converted to floats, and the returned value is 
also a float.  These specific arguments convert to the same float:

>>> a = 12345678901234567890
>>> b = 12345678901234567891
>>> float(a) == float(b)
True

And the float they convert _to_ retains only the 53 most-significant bits of 
the inputs:

>>> int(float(b))
12345678901234567168
>>> c = _
>>> c.bit_length()
64
>>> bin(c)
'0b1010101101010100101010011000110011101011000111110000100000000000'

Note that the last 11 bits are zeroes, and 64 - 11 = 53.

So this is all doing what it's intended to do, and won't be changed.

I'm leaving this open, though, in case someone thinks the docs should be 
clarified.  But the same things apply to _many_ functions in the `math` module: 
 unless the docs specifically say they work with integer arguments, integer 
arguments are converted to float.

Oops!  Someone else already closed this while I was typing.  That's fine by me 
too ;-)

----------
nosy: +tim.peters

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39525>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to