couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Joseph Davis (Commented) (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-1410) Formally define number support
Date Tue, 14 Feb 2012 15:41:59 GMT


Paul Joseph Davis commented on COUCHDB-1410:

So this whole thing has really gotten blown out of proportion. While we have never formally
documented what's going on internally, it can be described as such:

A number is parsed into one of two forms:

If the number contains a decimal point (".") or an exponent ("e" or "E") then the number is
internally converted into an IEEE-754 floating point representation. This means that numbers
containing either a decimal point or exponent are subject to the constraints of having a finite
number of bits representing the number as is standard operating procedure.

If a number does not contain a decimal point or exponent then it is parsed as an integer with
(theoretically) no loss of precision (I think precision is bound by the amount of RAM IIRC
but I don't promise there aren't any bugs). (Side note for Jiffy, technically, if a number
fits in a signed 64bit representation, that is used. If not then parsing is deferred back
to Erlang which handles parsing as a bignum).

Literally, the only thing that's wrong in COUCHDB-1407 is that number formatting for doubles
changed a wee bit and it has a simple fix and now people are getting all crazy about numbers
and ignoring other places that JSON is munged. Blergh.
> Formally define number support
> ------------------------------
>                 Key: COUCHDB-1410
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>    Affects Versions: 1.2
>            Reporter: Robert Newson
>            Priority: Blocker
>             Fix For: 1.3
> The JSON spec has a very loose definition of Number. CouchDB, as a database, should have
well-defined and first class support for numbers (both integral and decimal). The precision
of number support should be formally specified as should the algorithm used to represent floating-point
values, especially where an approximation must be made in the conversion.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message