Author casevh
Recipients Amaury.Forgeot.d'Arc, Jim.Jewett, Ramchandra Apte, amaury.forgeotdarc, benjamin.peterson, casevh, ced, eric.smith, eric.snow, haypo, jjconti, mark.dickinson, pitrou, rhettinger, skrah
Date 2012-03-07.08:30:00
SpamBayes Score 3.18012e-09
Marked as misclassified No
Message-id <1331109001.85.0.604470016125.issue7652@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-03-07 08:30:02casevhsetrecipients: + casevh, rhettinger, amaury.forgeotdarc, mark.dickinson, pitrou, haypo, eric.smith, benjamin.peterson, jjconti, ced, skrah, Amaury.Forgeot.d'Arc, eric.snow, Ramchandra Apte, Jim.Jewett
2012-03-07 08:30:01casevhsetmessageid: <1331109001.85.0.604470016125.issue7652@psf.upfronthosting.co.za>
2012-03-07 08:30:01casevhlinkissue7652 messages
2012-03-07 08:30:00casevhcreate