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.
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
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.