Re: [Json] Limitations on number size?

"Peter F. Patel-Schneider" <> Wed, 10 July 2013 00:16 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id F240011E80D3 for <>; Tue, 9 Jul 2013 17:16:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.436
X-Spam-Status: No, score=-2.436 tagged_above=-999 required=5 tests=[AWL=0.163, BAYES_00=-2.599]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id BQ8XVqxe1Fok for <>; Tue, 9 Jul 2013 17:16:41 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:4003:c01::231]) by (Postfix) with ESMTP id ED80911E8140 for <>; Tue, 9 Jul 2013 17:16:39 -0700 (PDT)
Received: by with SMTP id ta17so7658449obb.36 for <>; Tue, 09 Jul 2013 17:16:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=huQz9oQLNs8nv6pE2URcyxGN1PygJZPwvjVJR9DkvOY=; b=Ky+EihmssE3hwdHGm1lH1kEaNy5O+aJi87sImIIluiCjHgmCwZdbhsL/PO4LJfhVoV r2BSycQ7h/FLrQ6fsL9AeDbehSM3MZ8IONHMcyMfs1aLXZdjsIcPsouRl6OEJGXwqaoU gcU8TZDulT21cdCxUwJ0Lu1/rDUZIom5EVAIxWEsbQqHYkj7Kxf6Zd6VM3xGIEVCSOou lHyi8zzVDykDhZF1z2NKY4mDUaFiuuNHv8qhgH/9I8/fyWlm7N4McupKkybXGGW134b6 NUwp8b8YN6vPwRp2+GXXUw5H82JHtics6HjarsXJv6PghCPn6Soi6iDacLj+SFTfcT4T N34w==
X-Received: by with SMTP id q5mr26002749oem.79.1373415399356; Tue, 09 Jul 2013 17:16:39 -0700 (PDT)
Received: from [] ( []) by with ESMTPSA id df11sm41772456oec.0.2013. for <multiple recipients> (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Jul 2013 17:16:38 -0700 (PDT)
Message-ID: <>
Date: Tue, 09 Jul 2013 17:16:29 -0700
From: "Peter F. Patel-Schneider" <>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
MIME-Version: 1.0
To: Jorge Chamorro <>
References: <> <> <> <> <> <> <>
In-Reply-To: <>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: Nico Williams <>, Bjoern Hoehrmann <>,
Subject: Re: [Json] Limitations on number size?
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 10 Jul 2013 00:16:43 -0000

*Any* number?  Not so!  Assuming sane rules, JSON numbers are inadequate for 
representing all rationals, and the same holds, of course, for any superset of 
the rationals, including reals and complex.  (Yes, yes, no usable data format 
can represent all the reals or complex numbers.)

JSON numbers are unlike the numeric type system of any programming language 
that I had been familiar with, even LISP.  That JSON numbers are so close to 
ECMAScript numeric literals is, to me, a very strong indication that JSON 
numbers are supposed to represent ECMAScript numbers.

I do agree that implementations may be range-restricted, and that a data 
interchange format shouldn't always nail the ranges down exactly.   However, 
floats (being rather unusual numbers) are one place where it can be fruitful 
to nail things completely down.

Peter F. Patel-Schneider

On 07/09/2013 04:24 PM, Jorge Chamorro wrote:
> On 10/07/2013, at 00:46, Peter F. Patel-Schneider wrote:
>> 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.
> And given the super-simple rules in the RFC *any* number can be properly represented which is -it seems to me- exactly what Crockford had in mind: that JSON (the data interchange format) does not impose the limits.
> That the platforms, languages, libraries, and stringify()er and parse()r implementations may have numeric data type limitations, isn't JSON's (the data interchange format) business.