couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evan McLean <e...@michevan.id.au>
Subject Re: json/couchdb integer min max values
Date Mon, 23 Mar 2009 00:59:17 GMT
 >
 > The easiest way to check should just be to throw a few documents with
 > really large numbers in them.
 > Also do some views, I think the real issue will be the standard floating
 > point number limitation inside of JavaScript.

The mozilla javascript site[1] says it is a EMCA 262 Edition 3 compliant 
implementation, so looking at section 8.5 (page 31) of the spec[2] I 
found the following two excerpts that are salient to integers:


Note that all the positive and negative integers whose magnitude is no 
greater than 2^53  are representable in the Number type (indeed, the 
integer 0 has two representations, +0 and -0).

Some ECMAScript operators deal only with integers in the range -2^31 
through 2^31-1, inclusive, or in the range 0 through 2^32-1,  inclusive. 
These operators accept any value of the Number type but first convert 
each such value to one of 2^32 integer values. See the descriptions of 
the ToInt32 and ToUint32 operators in sections 9.5 and 9.6, respectively.


So, reading from that, it should support values between 
-9,007,199,254,740,992 and 9,007,199,254,740,992, but if you really want 
to play it safe, stick with values between -2,147,483,648 and 2,147,483,647.

Assuming erlang/couchdb can match that, that's probably the integer 
based limits you want to worry about.

Sound about right?

E.

P.S. I'll try and remember to run some tests when I get home tonight to 
confirm this (unless someone beats me to it).

[1] https://developer.mozilla.org/en/About_JavaScript
[2] http://www.mozilla.org/js/language/E262-3.pdf


Mime
View raw message