[issue39525] math.remainder() give wrong answer on large integer

2020-02-01 Thread Tim Peters
Tim Peters 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 _t

[issue39525] math.remainder() give wrong answer on large integer

2020-02-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: math.remainder performs *floating point* remainder. That means it has to convert the arguments to floats first, and there is no float capable of representing either of those two numbers exactly: py> '%f' % float(12345678901234567890) '12345678901234

[issue39525] math.remainder() give wrong answer on large integer

2020-02-01 Thread David Hwang
New submission from David Hwang : These two numbers are off by 1, and so should give different answer to >>> math.remainder(12345678901234567890,3) 1.0 >>> math.remainder(12345678901234567891,3) 1.0 -- components: Library (Lib) messages: 361211 nosy: David Hwang priority: normal severit