incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: Fixed precision of floating point number not respected in views
Date Wed, 20 Feb 2013 11:14:35 GMT
On Wed, Feb 20, 2013 at 11:33 AM, Robert Newson <rnewson@apache.org> wrote:

> I think we've said this every way it can be said now.
>
About the maths and the json limits probably. But maybe as a *data*
storage we could offer a convenient way to maintain formats or data
types when a uploading a doc. I mean even if you have stored
-33.91017999999999688 in the db, if someone asking to have only 5
decimals then it will for sure become  -33.91018  in most of the maths
systems.

In short i'm currently asking if the db should offer such facility (I
find it interresting) of just let the app to do it. One good thing on
forcing it in the db level is that all the clients that would access
to this data will have the same result not depending on their own
library:


js> os = '{"a": -33.91018 }'
"{\"a\": -33.91018 }"
js> o = JSON.parse(os)
({a:-33.91018})
js> o.a
-33.91018

>>> os = '{"a": -33.91018 }'
>>> import json
>>> o = json.loads(os)
>>> o['a']
-33.91018


1> OS = << "{\"a\": -33.91018 } ">>
1> .
<<"{\"a\": -33.91018 } ">>
2> jiffy:decode(OS).
{[{<<"a">>,-33.91018}]}




- benoƮt

Mime
View raw message