getting Ceil() of Decimal in python?

Posted by Gunjan on Stack Overflow See other posts from Stack Overflow or by Gunjan
Published on 2010-05-08T22:51:39Z Indexed on 2010/05/08 22:58 UTC
Read the original article Hit count: 317

Filed under:
|
|
|

Is there a way to get the ceil of a high precision Decimal in python?

>>> import decimal;
>>> decimal.Decimal(800000000000000000001)/100000000000000000000
Decimal('8.00000000000000000001')
>>> math.ceil(decimal.Decimal(800000000000000000001)/100000000000000000000)
8.0

math rounds the value and returns non precise value

© Stack Overflow or respective owner

Related posts about python

Related posts about decimal