Re: [Json] Limitations on number size?

Jacob Davies <jacob@well.com> Tue, 09 July 2013 23:49 UTC

Return-Path: <cromis@gmail.com>
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 37C5C11E80D3 for <json@ietfa.amsl.com>; Tue, 9 Jul 2013 16:49:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, NO_RELAYS=-0.001]
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 bNXKDd+T8zZo for <json@ietfa.amsl.com>; Tue, 9 Jul 2013 16:49:45 -0700 (PDT)
Received: from mail-qc0-x234.google.com (mail-qc0-x234.google.com [IPv6:2607:f8b0:400d:c01::234]) by ietfa.amsl.com (Postfix) with ESMTP id 9FA8D21F9CAE for <json@ietf.org>; Tue, 9 Jul 2013 16:49:45 -0700 (PDT)
Received: by mail-qc0-f180.google.com with SMTP id a1so3341491qcx.39 for <json@ietf.org>; Tue, 09 Jul 2013 16:49:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=9AIwXaJL9cmx/xut70++tbbV4BNfKc/bMpLVoJZZcek=; b=IcvR0wQQwuv+32oUNe1RHZIJN3V79omhyGHFuQ5vqzzbMmZDxAlTv19C4ZYodWuBWi Ux0msjduonsCAu1if48q7A8O5e5FJsV4K31G7hxL/z82OVdcoXk57pUZZ/U44wBDkY11 oCAyaaMz4s5XHqecqmFmmmr5yC0X4ww4MDA2cHT1DAe+bT3zWaWBgEX2B2e1U/xAFbSd 9a6EWpXtX1kY4ktZFe/cHqXE1h7sov+vJ/AzE+vsnwyD2AM5I0nSuCKrBKgmdCm0Oe3x Bl6i/72MDVvnCylwIIGQR/IMph6GoboB4FwOfkJjWJV7wYEfaPEnVOGK91bv7C9CU5mH rHVg==
X-Received: by 10.224.128.2 with SMTP id i2mr26170713qas.11.1373413785130; Tue, 09 Jul 2013 16:49:45 -0700 (PDT)
MIME-Version: 1.0
Sender: cromis@gmail.com
Received: by 10.49.76.42 with HTTP; Tue, 9 Jul 2013 16:49:25 -0700 (PDT)
In-Reply-To: <51DC95B2.8080801@gmail.com>
References: <51DC0F95.7010407@gmail.com> <hf8ot8hnpa93pi3t54c4d5qcc3p5tnb3ca@hive.bjoern.hoehrmann.de> <CAK3OfOgTNaLpRthrRcU4Bo+3z1aXUOOn0Ord7RBPN8z6TtiiWw@mail.gmail.com> <51DC7F87.6060503@gmail.com> <CAGrxA24v5L7oCGxEOwecJSLCNiLrSWSt=jFJMA0M9E8fztNLag@mail.gmail.com> <51DC95B2.8080801@gmail.com>
From: Jacob Davies <jacob@well.com>
Date: Tue, 9 Jul 2013 16:49:25 -0700
X-Google-Sender-Auth: iZqPTxHNkx52zuoqMLCJ1_NFG80
Message-ID: <CAO1wJ5SPGTo4=U9exJqWtL_4K521_tBKqD_LxBDb0UzfBzRhqA@mail.gmail.com>
To: "Peter F. Patel-Schneider" <pfpschneider@gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Cc: Nico Williams <nico@cryptonector.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, Tatu Saloranta <tsaloranta@gmail.com>, "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
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, 09 Jul 2013 23:49:46 -0000

On Tue, Jul 9, 2013 at 3:58 PM, Peter F. Patel-Schneider
<pfpschneider@gmail.com> wrote:
> The only suitable guidance provided in RFC4627 is via ECMAScript and
> ECMAScript is firmly IEEE floating point double only.
>
> So why are you surprised that I came up with this conclusion?

What I found surprising was that there appeared to be lots of people
willing to say that the strings in the JSON data model (not the
format) are Unicode, or that the keys in the objects must be unique
according to one particular method of string normalization, but not
that the numbers in JSON are derived from Javascript and that
interoperability in the most important use of JSON (sending data to
browsers) absolutely requires you to stay within the size limit of
Javascript numbers (and failure to do so has led to some notable bugs
that require backwards-incompatible API changes, i.e. going from
number -> string for some field).

My take prior to this discussion was that the mild annoyance of not
being able to send 9223372036854775807 as a number in JSON was the
reasonable price you paid for having an interoperable number range in
the format. It seemed like most people here disagreed with my
impression, which is fair enough, and it sounded like Douglas
Crockford's intent was not to restrict them in such a way, but I would
be surprised if many people actually - intentionally at least! - use
numbers from outside the Javascript range in JSON, given the problems
it causes for Javascript.

As for numbers smaller than that range, the RFC says implementations
may reject numbers they don't like, so an implementation without
floating point numbers is OK, just not capable of general
interoperability.