Case Van Horsen <[email protected]> added the comment:
I've found some differences between decimal and cdecimal.
cdecimal 2.3 does not support the __ceil__ and __floor__ methods that exist in
decimal. math.ceil converts a cdecimal.Decimal instance into a float before
finding the ceiling. This can generate incorrect results.
>>> import decimal
>>> import math
>>> math.ceil(decimal.Decimal("12345678901234567890.1"))
12345678901234567168
The decimal module in previous versions returns the correct answer
12345678901234567891
cdecimal.Decimal instances do not emulate the various single-underscore methods
of a decimal.Decimal instance. In gmpy2, I use _int, _exp, _sign, and
_is_special to convert a decimal.Decimal into an exact fraction. I realize the
issue is with gmpy2 and I will fix gmpy2, but there may be other code that uses
those methods.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue7652>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com