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

Tim Bray <tbray@textuality.com> Tue, 27 May 2014 17:45 UTC

Return-Path: <tbray@textuality.com>
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 BBFE71A01BB for <json@ietfa.amsl.com>; Tue, 27 May 2014 10:45:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.977
X-Spam-Level:
X-Spam-Status: No, score=-1.977 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
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 MSmbLFJUjjYh for <json@ietfa.amsl.com>; Tue, 27 May 2014 10:45:04 -0700 (PDT)
Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 252261A0527 for <json@ietf.org>; Tue, 27 May 2014 10:45:03 -0700 (PDT)
Received: by mail-ve0-f173.google.com with SMTP id pa12so11206251veb.32 for <json@ietf.org>; Tue, 27 May 2014 10:44:59 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=eFpicFU7l6o7RxSHDBz+39d/8mP+1ZkSh1HwuQsH68E=; b=c+ruszIbFwFY8tg5Gzt3AvbfAtbEJswLD8D7dnzDRjdF5AkW9uP80wALeuGdylx76I j7lMUfwep87YEeJJuaTedvTK7C94INeBraLu2FUe6uD7FWB1gDXM/OqrSN4/bdtr5aPm /KOzyr1VQBWoVVkGP5HdTx4//KJaCrEijN++7OgWV/KAtJe/khVQ/k5AJGY7XducOkJw f4/gMXmiejsPTTwQjhHM5lFq+6NKNyIWPt10aL8NsFjsYF6p//F7JBIePvcWMqYxd0bg bVBP78FdbFu1SiICXLYXxOi1+LA9WsYcD8ZMezM6LNHjRDcep/QAzG1o3k/fJHRbvyxH YbgQ==
X-Gm-Message-State: ALoCoQlSTHEpeIxHUbepmuBJNGlxtEDMIvQd46GVLtwn3VdDxA1nMsAXHwwk0zGbCHciJhNSzirY
X-Received: by 10.220.166.211 with SMTP id n19mr2393033vcy.69.1401212699453; Tue, 27 May 2014 10:44:59 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.220.98.73 with HTTP; Tue, 27 May 2014 10:44:39 -0700 (PDT)
X-Originating-IP: [24.85.103.37]
In-Reply-To: <14DB352D-3D0C-458A-90BE-38BCA8CC98DD@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>
From: Tim Bray <tbray@textuality.com>
Date: Tue, 27 May 2014 12:44:39 -0500
Message-ID: <CAHBU6isjZjfoga_g9efiK1L=Pf40ZQXg8War+k9JDM13quHPOQ@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Content-Type: multipart/alternative; boundary="047d7b34344834c2bd04fa65413f"
Archived-At: http://mailarchive.ietf.org/arch/msg/json/vpWmY-0YDRx8o1_mdCp_h8hMdh0
Cc: Nico Williams <nico@cryptonector.com>, IETF JSON WG <json@ietf.org>, Matt Miller <mamille2@cisco.com>
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: Tue, 27 May 2014 17:45:06 -0000

Just to make it clear. The WG is looking at three options:

- leave it like it is in draft-i-json-01
- Add John’s paragraph: "An I-JSON sender MUST NOT expect a receiver to
treat a non-zero number whose absolute value is greater than 1e308 or less
than 1e-308 as an exact value.  Furthermore, an I-JSON sender MUST NOT
expect a receiver to treat an integer whose absolute value is greater than
9007199254740992 as an exact value."
- Add some more text; there’s been some arm-waving on the mailing list, but
no actual proposals that I could crystallize into spec text.




On Tue, May 27, 2014 at 12:27 PM, Carsten Bormann <cabo@tzi.org> wrote:

> On 27 May 2014, at 18:45, Matt Miller <mamille2@cisco.com> wrote:
>
> > I've been told off-list that IEEE 754 (which is referenced from RFC
> > 7159, in case we've all forgotten) doesn't cover this topic at all,
> > and my own superficial review leads me to concur.
>
> IEEE Std 754-2008 describes a number of formats, and binary64 (the one
> that JavaScript and thus many JSON implementations uses) is just one of
> them.  You need to combine some basic CS knowledge with the specific
> constants for binary64 inserted into the generic formulae given before you
> can derive much meaningful information from IEEE Std 754-2008.
>
> An obvious reference (heed the title!) is
>
> David Goldberg: What Every Computer Scientist Should Know About
> Floating-Point Arithmetic, Computing Surveys, March, 1991.
>
> (reprint available from:
> http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html ).
> That does discuss binary64 (not under this name), but does not benefit
> from the recent changes to IEEE 754.
> It is also probably more accessible to CS people than to the general
> public.
>
> “95% of the folks out there are completely clueless about floating-point.”
> (James Gosling 1998-02-28, as attributed by William Kahan)
>
> We cannot fix this in this draft.
>
> What we can do is warn that the only numbers that have a good chance to be
> taken as exact numbers are the integers in [-2**53, 2**53], and that all
> numbers in many implementations are subject to the whims of floating point
> arithmetic as defined for binary64 in IEEE Std 754-2008.
> I wouldn’t try to go beyond that.  (In particular I’d not single out
> denorms, but I think I said that already.)
>
> Grüße, Carsten
>
>


-- 
- Tim Bray (If you’d like to send me a private message, see
https://keybase.io/timbray)