Re: [Json] Limitations on number size?

"Peter F. Patel-Schneider" <pfpschneider@gmail.com> Tue, 09 July 2013 22:46 UTC

Return-Path: <pfpschneider@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 9CC3E11E817A for <json@ietfa.amsl.com>; Tue, 9 Jul 2013 15:46:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.499
X-Spam-Level:
X-Spam-Status: No, score=-2.499 tagged_above=-999 required=5 tests=[AWL=-0.500, BAYES_00=-2.599, J_CHICKENPOX_66=0.6]
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 ZljYVDqB-K80 for <json@ietfa.amsl.com>; Tue, 9 Jul 2013 15:46:15 -0700 (PDT)
Received: from mail-ob0-x22f.google.com (mail-ob0-x22f.google.com [IPv6:2607:f8b0:4003:c01::22f]) by ietfa.amsl.com (Postfix) with ESMTP id 290F421F9C69 for <json@ietf.org>; Tue, 9 Jul 2013 15:46:15 -0700 (PDT)
Received: by mail-ob0-f175.google.com with SMTP id xn12so7545833obc.20 for <json@ietf.org>; Tue, 09 Jul 2013 15:46:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=N9LYxfDZrM5QXsQ2WyFUDMGB5kJ+SOzHXuCoTyts5O8=; b=k0uS8aODw8SEO6bP1BVCEtw5yoigITqFDdax/lDhlF7Q580wQbV08lOjqrPjIDVGPk /Iu8h81HWqSOAvHstqunOZEvyR4HbBVahJNX6w4cWD0Nvdb+KTkj0xOJSdfcoL0kYxie yHI+4gvWGF7n02durwwjAY64UooVBFB2TrCAMk/B3Bsp50VaSWwrJS/sJ+CjqfKRRP6I E1hMK/8RstvEDRcXPT/dpDLjTuabCK5HIoc9aGd2HvPXX65xYxOAZQ7SjH0QO00VZuCG r5Jed+OSDsx6KJPeS8ZT8A4iSuHSz4/BAkW0nKP+K+0NaJbBHb3im2zhkop7dURb1bZr XBxg==
X-Received: by 10.182.205.138 with SMTP id lg10mr25836047obc.6.1373409973632; Tue, 09 Jul 2013 15:46:13 -0700 (PDT)
Received: from [192.168.1.102] (out-on-158.wireless.telus.com. [207.219.69.158]) by mx.google.com with ESMTPSA id q4sm40616927obl.1.2013.07.09.15.46.11 for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Jul 2013 15:46:12 -0700 (PDT)
Message-ID: <51DC92B1.7000908@gmail.com>
Date: Tue, 09 Jul 2013 15:46:09 -0700
From: "Peter F. Patel-Schneider" <pfpschneider@gmail.com>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
MIME-Version: 1.0
To: Jorge Chamorro <jorge@jorgechamorro.com>
References: <51DC0F95.7010407@gmail.com> <hf8ot8hnpa93pi3t54c4d5qcc3p5tnb3ca@hive.bjoern.hoehrmann.de> <CAK3OfOgTNaLpRthrRcU4Bo+3z1aXUOOn0Ord7RBPN8z6TtiiWw@mail.gmail.com> <51DC7F87.6060503@gmail.com> <D3773B95-FF52-45D7-BE9F-2DEC92AFA67E@jorgechamorro.com>
In-Reply-To: <D3773B95-FF52-45D7-BE9F-2DEC92AFA67E@jorgechamorro.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Nico Williams <nico@cryptonector.com>, Bjoern Hoehrmann <derhoermi@gmx.net>, 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 22:46:15 -0000

On 07/09/2013 03:19 PM, Jorge Chamorro wrote:
> On 09/07/2013, at 23:24, Peter F. Patel-Schneider wrote:
>> Imagine my surprise when I was told that my reasoning was not correct.
> A "JSON number" is a *text* not a number:

OK, OK.  A JSON number represents a number.   I'm guilty of not being 
appropriately pedantic.

But everything that I've read about JSON indicates that JSON is supposed to be 
used for (portably) interchanging data.  If all there is to JSON is the 
grammar then what's the point of JSON?

>
> number = [ minus ] int [ frac ] [ exp ]
>
>           decimal-point = %x2E       ; .
>
>           digit1-9 = %x31-39         ; 1-9
>
>           e = %x65 / %x45            ; e E
>
>           exp = e [ minus / plus ] 1*DIGIT
>
>           frac = decimal-point 1*DIGIT
>
>           int = zero / ( digit1-9 *DIGIT )
>
>           minus = %x2D               ; -
>
>           plus = %x2B                ; +
>
>           zero = %x30                ; 0
>
> A character representation of a number that follows the rules in the RFC 4627 that -unlike ECMAScript- doesn't say a thing about its precision, integer-ness, floating-point-ness, allowable ranges or the likes.

And neither does the BNF for numeric types in most programming languages, 
including ECMAScript.   The BNF syntax for numbers in ECMAScript permits 
arbitrarily long sequences of digits.   As far as I can recall C, C++, and ML 
all have the same characteristic.

What is (surprisingly) missing in JSON is a firm notion of the data being 
represented by the syntax.   A pale shadow of this issue for strings appears 
to have been consuming this working for quite some time.
>
>
> To say that a "JSON number" (which is a text) is === IEEE-754 double doesn't make too much sense.

OK, then, what I inferred was that a JSON number represents an IEEE floating 
point double and I was very surprised to find out that this was not the case.


Peter F. Patel-Schneider
>
>
> JSON.stringify(number:number) -> text:JSON_number
> JSON.parse(text:JSON_number)  -> number:number