incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Integers changed to float in Couch 0.11.0
Date Fri, 09 Apr 2010 18:54:07 GMT
On Fri, Apr 9, 2010 at 1:13 PM, Filipe David Manana <fdmanana@gmail.com> wrote:
> On Fri, Apr 2, 2010 at 3:37 PM, Paul Davis <paul.joseph.davis@gmail.com>wrote:
>
>>
>> Well, there's a limit to what can be stored in an integer remember. I
>> wouldn't really hold my breath for anything larger than 2147483648
>> (2^31). The reason that Futon shows something different is because
>> JavaScript treats all numbers as floats and then at display time it'll
>> not display a fractional part if it's zero.
>>
>> I'm suprised that it used to work. Can anyone else on 0.10 verify
>> that? I'm not sure if I remember anything changing in the number
>> handling in mochijson or not.
>>
>>
> It changed:
>
> http://code.google.com/p/mochiweb/source/detail?r=43
>
> JSON (and JavaScript) doesn't have a float or integer type. Everything is of
> type number. So anything greater than (2^31) - 1 can be represented without
> the decimal separator.
>
> In JavaScript:
>
>>>> n1 = 1270162450695
> 1270162450695
>>>> n2 = 1270162450695.0
> 1270162450695
>>>> n1 === n2
> true
>
> I dunno why mochijson2 is making a distinction between integers vs floats.
>

Oh how awesome. I have no idea why mochijson would do such a thing.
The only thing that's ever specified about numbers and limits is in
section 4 with the note "An implementation may set limits on the range
of numbers."

Blargh.

>
>
>> HTH,
>> Paul Davis
>>
>
>
>
> --
> Filipe David Manana,
> fdmanana@gmail.com
>
> "Reasonable men adapt themselves to the world.
> Unreasonable men adapt the world to themselves.
> That's why all progress depends on unreasonable men."
>

Mime
View raw message