couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: [VOTE] Apache CouchDB 1.2.0 release, first round
Date Sun, 12 Feb 2012 19:01:09 GMT
On Sun, Feb 12, 2012 at 5:48 PM, Noah Slater <nslater@tumbolia.org> wrote:
> I've been over this before:
>
> http://code.google.com/p/simplejson/issues/detail?id=34
>
>
> From Bob Ippolito:
>
> Try alert(2.2000000000000002 == 2.2) in ANY browser. It will say true.
>> JavaScript uses IEEE double for  Number, always has, always will.
>
>
> The general consensus seems to be that if you don't want JSON messing
> around with your numbers, then you encode them as strings. Otherwise,
> unless you're using integers, expect weirdness.
>
> However, I'm not sure I understand our choices here.
>
> Could someone explain the choices we have, with a summary of what the net
> result would be?
>

Well i think the concern is biased.  the "alert(2.2000000000000002 ==
2.2) in ANY browser" is also true in python :

    >>> 2.2000000000000002 == 2.2
    True

But that's not the real question. If we don't store the number like it
was given in couchdb it means we are changing the information, which
is by itself a problem. It also may be a problem for those who need to
have this big precision in their application and it may be a problem
for the future uses of this data when the raw version have been lost.

- Storing as string is okish, though why i should transform to and
from a string when I just wanted to give a number and I had a number
at first?

- We could be better than javascript, it's true that
2.2000000000000002 == 2.2, but it is also true that 2.2 ==
2.2000000000000002, so we can store the precision. and imo that is a
MUST have.

Why can't we do the second actually in jiffy or ejson ? Technically speaking?

- benoît

Mime
View raw message