incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Davies <ja...@jasondavies.com>
Subject Re: Is fixed precision arithmetic possible in couchdb python?
Date Tue, 01 Sep 2009 12:58:24 GMT
Also, if you are worried about loss of precision with large integers  
(with more than 15 digits) you should use a JavaScript port of  
BigInteger (or BigDecimal) for calculations and store the numbers as  
strings.  I'm successfully using BigDecimal for financial calculations  
at the moment.  It's probably overkill for most people but it works.   
See also http://issues.apache.org/jira/browse/COUCHDB-227 for some  
links about this issue.

Cheers,
--
Jason Davies

www.jasondavies.com

On 1 Sep 2009, at 13:47, Paul Davis wrote:

> Noah Slater had a post quite some time ago where he admonished the use
> of floats for money. He said to always use two integers and figure out
> the mat yourself. With floats is only a matter of time before you
> start missing pennies.
>
> It stuck with me so I thought I'd mention it.
> Paul
>
> On Tue, Sep 1, 2009 at 5:27 AM, Metin Akat<akat.metin@gmail.com>  
> wrote:
>> Hm, this makes sense. I guess I'll go this way. Thanks
>>
>> On Tue, Sep 1, 2009 at 12:18 PM, Robert Newson<robert.newson@gmail.com 
>> > wrote:
>>> Multiply your numbers by the amount of precision you need and use
>>> integers (*1000 for 3 d.p)? Using floating point to store money
>>> amounts seems fraught with rounding errors.
>>>
>>> B.
>>


Mime
View raw message