couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Davies (JIRA)" <>
Subject [jira] Commented: (COUCHDB-227) Large Number Support Bug
Date Mon, 26 Jan 2009 15:57:59 GMT


Jason Davies commented on COUCHDB-227:

This is due to JavaScript 1.x representing all numbers as 64-bit floating point numbers, which
means only 15 digits of reliability for integers (see

JSON itself effectively allows arbitrary-precision decimals, as JSON is just a general-purpose
data description language.  I am guessing that if the Python view server is used, then the
view will return the correct values (as Python supports long integers).

I did some research into JavaScript and precision because I wanted to use CouchDB to do financial
calculations (e.g. summation of product prices).  ECMAScript 4 (or JavaScript 2) seems to
support "real decimals":

I'm not sure when Spidermonkey will have ECMAScript 4, but when it does it looks like we'll
get all the juicy benefits of real decimals.  In the meantime, we should document this in
case it gives anyone a nasty surprise...

> Large Number Support Bug
> ------------------------
>                 Key: COUCHDB-227
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Administration Console, JavaScript View Server
>            Reporter: Adam Kocoloski
> It looks like SpiderMonkey rounds large integers.  To reproduce,  create a document in
Futon with a field value
> 9999999999999999
> Futon will round this to 10000000000000000.  Or, create a document with that field value
by some other means and then emit the field in a view.  The document will have the correct
value for the field, but the value in the view will be wrong.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message