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

Carsten Bormann <cabo@tzi.org> Tue, 29 April 2014 04:52 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 572381A08AD for <json@ietfa.amsl.com>; Mon, 28 Apr 2014 21:52:01 -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 qPdaX8d0mQ8z for <json@ietfa.amsl.com>; Mon, 28 Apr 2014 21:51:59 -0700 (PDT)
Received: from informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) by ietfa.amsl.com (Postfix) with ESMTP id 52F5E1A02E3 for <json@ietf.org>; Mon, 28 Apr 2014 21:51: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 s3T4pjbO007817; Tue, 29 Apr 2014 06:51:45 +0200 (CEST)
Received: from [192.168.217.140] (p5489262C.dip0.t-ipconnect.de [84.137.38.44]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp-fb3.informatik.uni-bremen.de (Postfix) with ESMTPSA id 8E47C1F92; Tue, 29 Apr 2014 06:51:45 +0200 (CEST)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (1.0)
From: Carsten Bormann <cabo@tzi.org>
X-Mailer: iPad Mail (11D201)
In-Reply-To: <CAO1wJ5RJL5jXYMRo9pxhNGc9Si5CLj5EmMLxWYntXsUFkGUbRA@mail.gmail.com>
Date: Tue, 29 Apr 2014 06:51:46 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <56A5D291-62BC-4E3C-A734-F8BC2358E831@tzi.org>
References: <535EB3BF.8080606@cisco.com> <CAHBU6ivjF9ULW0yGSVdJi2D6QgUThuhym_ZhpgLM=cvLu=mAiQ@mail.gmail.com> <CF841AAE.47D86%jhildebr@cisco.com> <CAO1wJ5RJL5jXYMRo9pxhNGc9Si5CLj5EmMLxWYntXsUFkGUbRA@mail.gmail.com>
To: Jacob Davies <jacob@well.com>
Archived-At: http://mailarchive.ietf.org/arch/msg/json/guf0z5YsDOkfekYe43RxgFHN0A0
Cc: "Matt Miller (mamille2)" <mamille2@cisco.com>, Tim Bray <tbray@textuality.com>, "Joe Hildebrand (jhildebr)" <jhildebr@cisco.com>, 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: Tue, 29 Apr 2014 04:52:01 -0000

I still have no idea what that MUST is supposed to mean.  Is 1.0 in, 1.000 out?  1.0000000000000000000000000?  Does it mean I can't write 1000000000000000000 but need to write 1e21 instead?  Actually, both numbers cannot be represented in binary64. 
Repeat with 1.1, 1.1000000, 1.100000000000000000000 etc.

Maybe what is meant here is excluding a number that doesn't round trip as a binary64?
But whether that is true depends on rounding rules etc. that aren't defined for JSON.
(There are several ways to write a binary64, e.g. 1.1 vs. the exact form of the number you get from rounding that into binary64.)

If that is supposed to be a MUST, there needs to be a testable definition.

Really, what needs to be excluded is the *intention* to obtain more precision! and there is no way to see whether there was such an intention from the actual JSON text. 

Oh, and 1e400 is a way to interchange Infinity in some JSON implementations, so this is not just about precision, but also about range.

Sent from my iPad

> On 28.04.2014, at 23:18, Jacob Davies <jacob@well.com> wrote:
> 
> On Mon, Apr 28, 2014 at 1:52 PM, Joe Hildebrand (jhildebr)
> <jhildebr@cisco.com> wrote:
>> Will we need to talk about subnormals, -0, NaN, Infinity, and the like?
> 
> NaN & infinity yes. Dunno about -0.
> 
> I think the burden on the emitter of requiring compliance is low. In
> Java AFAIK it's just a case of checking that the value is a legal
> double value, is not NaN and not infinite, and converting it with
> default toString() (you can trim ".0" from the end if present for
> neatness). On the receiver I think it would be rather more difficult.
> 
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>