couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <>
Subject Re: Silent corruption of large numbers
Date Sun, 08 Nov 2009 03:42:47 GMT
> 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?

RFC 4627 does mention this issue in passing in section 4 by saying "An
implementation may set limits on the range of numbers." Generally I
take this to mean that you're gonna have weird implementation
dependent behavior when dealing with the limits of common number
representations. As such, relying on the view engine to error out when
something else doesn't is gonna be a bit awkward at best. While not
the best answer the only thing I can suggest would be to do as Adam
says and store large values as strings and use a Bignum library in the
places you need to manipulate such values.

Even if we told the view server to error on such values, what would
that error look like? Would everyone be unable to pass a doc with a
big num through the view server (depending on language)? Things get
messy quick.

Paul Davis

View raw message