This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients David Hwang, steven.daprano
Date 2020-02-02.05:42:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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)
    py> '%f' % float(12345678901234567891)

That's just the way floats work. They don't have infinite precision, so sometimes they have rounding error.

If you want exact integer remainder, use the `%` operator:

    py> 12345678901234567890 % 3
    py> 12345678901234567891 % 3

See the tutorial and the FAQs
Date User Action Args
2020-02-02 05:42:11steven.dapranosetrecipients: + steven.daprano, David Hwang
2020-02-02 05:42:11steven.dapranosetmessageid: <>
2020-02-02 05:42:11steven.dapranolinkissue39525 messages
2020-02-02 05:42:11steven.dapranocreate