Bug report
Bug description:
I ran into a weird issue where abs(Decimal(8.95)) > 8.95
is returning True
:
Python 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] on linux
>>> from decimal import Decimal
>>> Decimal(1.0) > 1.0
False
>>> abs(Decimal(1.0)) > 1.0
False
>>> Decimal(8.95) > 8.95
False
>>> abs(Decimal(8.95)) > 8.95
True
>>> type(abs(Decimal(8.95)))
<class 'decimal.Decimal'>
>>> Decimal(8.95)
Decimal('8.949999999999999289457264239899814128875732421875')
>>> abs(Decimal(8.95))
Decimal('8.949999999999999289457264240')
I would normally expect to get an error like this:
>>> Decimal(1.0) + 1.0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'decimal.Decimal' and 'float'
CPython versions tested on:
3.10
Operating systems tested on:
Linux