couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roger Binns <rog...@rogerbinns.com>
Subject Re: Silent corruption of large numbers
Date Sun, 08 Nov 2009 01:45:57 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Anderson wrote:
> Can you confirm for me that when you load the doc directly (not via a
> view) the number is unchanged? I've tested CouchDB with much larger #s
> (but not in a while).
> 
> If the doc round-trips properly that means the precision is being lost
> inside the spidermonkey view engine, not in our Erlang JSON handling.

As Adam pointed out, the problem is indeed Javascript.  Accessing the
document directly does give the right answer.

Even more amusing is trying to enter or view 9223372036854775807 using
Futon.  If you enter it in the fields tab then the last 4 digits become
6000.  The same thing happens in the source tab which means the source is
being evaluated and redisplayed (annoying).  Displaying the record results
in the 6000 number even if the underlying record is the long number above.

So this means your testing only involved direct REST operations and not
using Futon or views :-)

I don't know what the right solution to this is.  I certainly believe that
the view code should error rather than just throw digits away.  Or perhaps
numbers larger than about 60 bits of precision should not be accepted?

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkr2ItEACgkQmOOfHg372QRfOQCgi4rqYTZh/VszD/2E6xWloBBq
a78AoKb+VEyImwz2eQpF0Xf4Z0qY7NlG
=mUSG
-----END PGP SIGNATURE-----

Mime
View raw message