Re: [Json] I-JSON Topic #5: Numbers

Carsten Bormann <cabo@tzi.org> Sat, 31 May 2014 05:23 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 668AF1A0741 for <json@ietfa.amsl.com>; Fri, 30 May 2014 22:23:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.551
X-Spam-Level:
X-Spam-Status: No, score=-1.551 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_DE=0.35, SPF_HELO_PASS=-0.001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7SWgLG9G7uO3 for <json@ietfa.amsl.com>; Fri, 30 May 2014 22:22:59 -0700 (PDT)
Received: from informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 492AB1A073C for <json@ietf.org>; Fri, 30 May 2014 22:22:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from smtp-fb3.informatik.uni-bremen.de (smtp-fb3.informatik.uni-bremen.de [134.102.224.120]) by informatik.uni-bremen.de (8.14.5/8.14.5) with ESMTP id s4V5Mlv2022556; Sat, 31 May 2014 07:22:47 +0200 (CEST)
Received: from [10.240.32.70] (unknown [213.179.18.114]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp-fb3.informatik.uni-bremen.de (Postfix) with ESMTPSA id 34A2A1A4F; Sat, 31 May 2014 07:22:47 +0200 (CEST)
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\))
Content-Type: text/plain; charset=utf-8
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CAHBU6itsC5mKjY98Xw1o5d3iHXvTiWgY-OoRtraHokScE38Lew@mail.gmail.com>
Date: Sat, 31 May 2014 07:22:45 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <7A96EC11-7B64-4981-AB50-39F3742BB7C7@tzi.org>
References: <535EB3BF.8080606@cisco.com> <CAHBU6ivjF9ULW0yGSVdJi2D6QgUThuhym_ZhpgLM=cvLu=mAiQ@mail.gmail.com> <CF841AAE.47D86%jhildebr@cisco.com> <CAHBU6itK5HtSTPWSsHsHUPja90emqU86LsgjrBorkqcUDivS2A@mail.gmail.com> <CF87EB9C.48BB0%jhildebr@cisco.com> <537A5BE0.3020406@cisco.com> <CF9FCEC9.4A4E7%jhildebr@cisco.com> <488AE66E-725D-40B3-9FDA-ADA1018BCF65@tzi.org> <CFA0F09E.4A609%jhildebr@cisco.com> <255B9BB34FB7D647A506DC292726F6E115461FFE59@WSMSG3153V.srv.dir.telstra.com> <20140521020731.GG9283@mercury.ccil.org> <CFA21B5C.4A721%jhildebr@cisco.com> <255B9BB34FB7D647A506DC292726F6E1154629E87D@WSMSG3153V.srv.dir.telstra.com> <CAHBU6isO7oooeN8rH8emx-xuOrs2yzBUrhyJNYYAyzK2-QfF0w@mail.gmail.com> <CAK3OfOih-YO-ncbSc3dVv_O7uHfjRxCDjUpzHmkFG5Dj7kb-xg@mail.gmail.com> <5384C118.4060402@cisco.com> <14DB352D-3D0C-458A-90BE-38BCA8CC98DD@tzi.org> <CAHBU6isjZjfoga_g9efiK1L=Pf40ZQXg8War+k9JDM13quHPOQ@mail.gmail.com> <DF223160-A135-4B8E-A895-53A4BF63AA1E@tzi.org> <5384D0C2.7030407@cisco.com> <62 E6DC51-2D3D-4C55-89D8-19810347A9FB@tzi.org> <CAHBU6itsC5mKjY98Xw1o5d3iHXvTiWgY-OoRtraHokScE38Lew@mail.gmail.com>
To: Tim Bray <tbray@textuality.com>
X-Mailer: Apple Mail (2.1878.2)
Archived-At: http://mailarchive.ietf.org/arch/msg/json/yMbC3n_Urm0piWDwJQDjZP-7Ex4
Cc: IETF JSON WG <json@ietf.org>
Subject: Re: [Json] I-JSON Topic #5: Numbers
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
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: Sat, 31 May 2014 05:23:03 -0000

On 30 May 2014, at 23:38, Tim Bray <tbray@textuality.com> wrote:

> On Tue, May 27, 2014 at 12:17 PM, Carsten Bormann <cabo@tzi.org> wrote:
> ​​   ➧ In particular, an I-JSON sender MUST NOT expect a receiver to treat
> ​​   an integer whose absolute value is greater than 9007199254740992 (i.e.,
> ​​   that is outside the range [-2**53, 2**53], where ** stands for exponentiation)
> ​​   as an exact value.
> 
> ​BTW, RFC7159 says: Note that when such software is used, numbers which are integers and are in the range [-(2**53)+1, (2**53)-1] are interoperable in the sense that implementations will agree exactly on their numeric values.​  So for consistency we should adjust this language to use this range and the absolute value of 9007199254740991 - right?

Consistency is good.

The new text makes use of the fact that 2**53+1 is the first integer that cannot be represented in binary64.
2**53 itself is a bit of an edge case because it can be represented exactly, but carries the uncertainty whether 2*53+1 was meant instead.
So if an implementation checks exactness only after conversion, it can only accept [-(2**53)+1, (2**53)-1].

Indeed, let’s stick with the narrower range [-(2**53)+1, (2**53)-1].

Grüße, Carsten