Re: [Json] Limitations on number size?

Stefan Drees <stefan@drees.name> Tue, 04 June 2013 10:43 UTC

Return-Path: <stefan@drees.name>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8408A21F9B03 for <json@ietfa.amsl.com>; Tue, 4 Jun 2013 03:43:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.249
X-Spam-Level:
X-Spam-Status: No, score=-2.249 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HELO_EQ_DE=0.35]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2ecVbDLVk5Z3 for <json@ietfa.amsl.com>; Tue, 4 Jun 2013 03:42:48 -0700 (PDT)
Received: from mout.web.de (mout.web.de [212.227.15.3]) by ietfa.amsl.com (Postfix) with ESMTP id D197121F9B06 for <json@ietf.org>; Tue, 4 Jun 2013 02:39:28 -0700 (PDT)
Received: from newyork.local.box ([93.129.187.165]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MHGed-1UfcrD0E8B-00E6xw; Tue, 04 Jun 2013 11:39:12 +0200
Message-ID: <51ADB5BF.4040504@drees.name>
Date: Tue, 04 Jun 2013 11:39:11 +0200
From: Stefan Drees <stefan@drees.name>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version: 1.0
To: Nico Williams <nico@cryptonector.com>
References: <CAK3OfOgPGi4PKxKAGEG=PCv-xaszMqWpUUUH2B9f0UaeMMO1gQ@mail.gmail.com> <C42654A3-E218-45A8-B368-4A60CB89619D@vpnc.org> <C4D8E604-E4F8-408B-B7DD-97226300C212@tzi.org> <CAK3OfOjDp=S=HZ5LTP3L+rqq1VjhSShakmBOJD9aPiN8fSULKw@mail.gmail.com>
In-Reply-To: <CAK3OfOjDp=S=HZ5LTP3L+rqq1VjhSShakmBOJD9aPiN8fSULKw@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Provags-ID: V02:K0:iPxNeHeQeceRBcxSifivfoJnvyhRRRyhb1wjc1Rv+95 wejm9rXmGf/P3K1ezm8drv5ripiSngTpHS70OQ9jwJVQaAHllw 0oQ7Ca48R62Lr0eabUdcB6i+XHydACzPo9GdcZR07lg1V6ao/z 2hRm7ut+MPUU4MyO1HaqJU+gqpj6d4imqs9x51cj/kmsWpP+io dGzQRLJ+LArT+IKLMmiZw==
Cc: Carsten Bormann <cabo@tzi.org>, Paul Hoffman <paul.hoffman@vpnc.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Limitations on number size?
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
Reply-To: stefan@drees.name
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 04 Jun 2013 10:43:03 -0000

On 04.06.13 09:59, Nico Williams wrote:
> On Tuesday, June 4, 2013, Carsten Bormann wrote:
>
>      >>> JavaScript might not, but JSON actually does have indefinite
>     length bignums. A JSON number can have any number of decimal digits.
>      >>
>      >> Yeah, but it is constrained to IEEE 754 64-bit floating point
>     values, no?
>      >
>      > I don't see any limitation in RFC 4627, but it would be
>     interesting if other folks here believe there is a limitation as
>     Nico does.
>
>     I think this is a nice example of the distinction between JSON the
>     representation format, a specific JSON application, and JSON the
>     ecosystem.
>
>     JSON the format has no trouble in representing high-precision
>     numbers (and big integers).
>     So if somebody wanted to send ECDSA signature r/s values as JSON
>     numbers, the format would be fine.
>
>
> This is a plausible answer, sure.  I'm not sure I'd want to say JSON can
> only represent IEEE754 64-bit numbers either, so if this is the
> consensus then that'll be fine by me.
>
> Do note that JSON's number encoding is indefinite-length...  ;) ...

In the wild - and in my little eco system at least - JSON is used more 
like ONS (Object Notation Serialization), isn't it?

I regard the "indefinite-length stream of digits to be interpreted as a 
number" as a small price for the unversal usability and acceptance of 
JSON as a format.

In conclusion such a change should IMO a) not qualify as a change being 
covered by the charter of the WG and would b) break several interesting 
use cases, where implementers would then be forced to put potentially(!) 
non IEEE754 64-bit number literals always into quotes instead of as now 
happily producing and consuming "streams" of say:

{/*...*/ "foo": [1.1, 0.2, 1234567890123456789012345678.9, 0.0 //...


All the best,

Stefan.