Closed
Description
I have encountered unexpected behavior while using the normalize()
method of the Decimal
class. I performed the following test using Python 3.10.10 and 3.11.4.
from decimal import Decimal
v1 = Decimal("0.99999999999999999999999999999")
v2 = v1.normalize()
print(v1) # Output: 0.99999999999999999999999999999
print(v2) # Output: 1
assert(v1 == v2) # trigger AssertionError
Based on my understanding, the normalize() method is intended to produce a canonical representation of a decimal number. However, in this case, the values of v1 and v2 are not matching, leading to an AssertionError.