[Python-Dev] Should I care what -3.14 // inf produces?

2021-09-30 Thread Jeff Allen
Is an implementation of Python free to make up its own answers to division and modulus operatons in the case of inf and nan arguments? The standard library documentation says only that // is "rounded towards minus infinity". The language reference says that ||: 1. |x == (x//y)*y + (x%y)|, 2.

[Python-Dev] Re: Should I care what -3.14 // inf produces?

2021-09-30 Thread Victor Stinner
Hi Jeff, The decimal module docstring starts with: """ This is an implementation of decimal floating point arithmetic based on the General Decimal Arithmetic Specification: http://speleotrove.com/decimal/decarith.html and IEEE standard 854-1987: http://en.wikipedia.org/wiki/IEEE_854-19

[Python-Dev] Re: Should I care what -3.14 // inf produces?

2021-09-30 Thread Serhiy Storchaka
30.09.21 10:07, Jeff Allen пише: from decimal import Decimal Decimal('-3.14') // Decimal('Infinity') > Decimal('-0') You do not need an infinity to see the difference. >>> Decimal('3.14') % Decimal('2') Decimal('1.14') >>> Decimal('3.14') % Decimal('-2') Decimal('1.14') >>> Decimal('-3.