incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samuel Williams <space.ship.travel...@gmail.com>
Subject Re: Numerical accuracy and precision
Date Mon, 16 Jul 2012 15:33:11 GMT
Well, I'm using a big integer library for accounting in Ruby, but I'm not
sure how to do map-reduce with JavaScript without potentially corrupting
values... what is the recommended approach?

Also, what is the precision of _sum and other builtin reductions?

Is there a recommended big integer library for use with the
JavaScript/SpiderMonkey interpreter and is this documented anywhere? With
the natural JSON format, I assume there are no limitations to integer size,
but clearly JSON -> JavaScript object will impose some data type
limitations... it seems like a language with built in support for big
integers would be ideal, e.g. Python, Ruby, rather than JavaScript.

Kind regards,
Samuel

On 17 July 2012 02:27, Robert Newson <rnewson@apache.org> wrote:

>
> Correct, numeric precision using the javascript view engine is limited to
> the 64-bit floating point numbers that spidermonkey supports.
>
> For arbitrary precision math, encode your values as strings and use a
> bignum library.
>
> As an aside, if you're using floating-point numbers in an accounting
> context, you have already fallen into sin.
>
> B.
>
> On 16 Jul 2012, at 15:01, Samuel Williams wrote:
>
> > Hi,
> >
> > I'm wondering, when using the JavaScript backend, is the numerical
> accuracy
> > limited to that of JavaScript?
> >
> > How can we implement a numerically correct sum function, e.g. using a big
> > integer implementation?
> >
> > Kind regards,
> > Samuel
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message