Re: [Json] -0.0

Carsten Bormann <cabo@tzi.org> Sun, 29 September 2013 08:31 UTC

Return-Path: <cabo@tzi.org>
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 1F81321F9F31 for <json@ietfa.amsl.com>; Sun, 29 Sep 2013 01:31:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.181
X-Spam-Level:
X-Spam-Status: No, score=-106.181 tagged_above=-999 required=5 tests=[AWL=0.068, BAYES_00=-2.599, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
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 JL3eKMjrF+Y6 for <json@ietfa.amsl.com>; Sun, 29 Sep 2013 01:31:49 -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 C983821F9EFB for <json@ietf.org>; Sun, 29 Sep 2013 01:31:46 -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.4/8.14.4) with ESMTP id r8T8Vgm3027653; Sun, 29 Sep 2013 10:31:42 +0200 (CEST)
Received: from [172.16.42.101] (p54890BA1.dip0.t-ipconnect.de [84.137.11.161]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp-fb3.informatik.uni-bremen.de (Postfix) with ESMTPSA id 73526286; Sun, 29 Sep 2013 10:31:42 +0200 (CEST)
Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\))
Content-Type: text/plain; charset="iso-8859-1"
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CAChr6SxYSzXGf5hrVNvmdmpHU2R+cKSH+37NhTc--6iDpfXG3g@mail.gmail.com>
Date: Sun, 29 Sep 2013 10:31:40 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <9D959999-63A2-46EF-8C14-C48F586D9DA4@tzi.org>
References: <BF7E36B9C495A6468E8EC573603ED9411EF1BB0B@xmb-aln-x11.cisco.com> <CAChr6SyznBktmOLpT-EiZ5Nm_0jZ16M0tOo4aZ_jhSDb=HHDqg@mail.gmail.com> <6D5CFCAD-5B75-4246-BE42-D42E4D35C344@vpnc.org> <CAChr6SzEBdgF_Cv2ZnC1Oo2CnL06dwZqsOKA=HTVkgArcTyLEw@mail.gmail.com> <CAHBU6iu=LbwcZgEPzKgurR7s+jCUeVMEagq1knzOBWUky9SLoA@mail.gmail.com> <52454988.5030706@it.aoyama.ac.jp> <20130927214137.GC24460@mercury.ccil.org> <BF7E36B9C495A6468E8EC573603ED9411EF1E1E5@xmb-aln-x11.cisco.com> <CAChr6SxfAv+yjEzsn2R=S79MviRN+bYak=8Nnnkw9hfs3p1zxw@mail.gmail.com> <CAChr6SxYSzXGf5hrVNvmdmpHU2R+cKSH+37NhTc--6iDpfXG3g@mail.gmail.com>
To: R S <sayrer@gmail.com>
X-Mailer: Apple Mail (2.1510)
Cc: JSON WG <json@ietf.org>
Subject: Re: [Json] -0.0
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: Sun, 29 Sep 2013 08:31:55 -0000

On Sep 28, 2013, at 00:15, R S <sayrer@gmail.com> wrote:

>> Yes. The text in the current draft refers to both -0 and -0.0 as though they are interoperable.
> 
> Rather, it refers to them both as though they have the same interoperability considerations.

Rightly so.

While the probability of being hit is lower (more JSON implementations do seem to implement -0.0 as distinct from 0.0), it would still be foolish to rely on interoperability of any form of negative zero.

(Two minutes of googling:
https://android.googlesource.com/platform/libcore/+/014aa1a70743ae7e6ec0de1555f5b43d43844cf4/json/src/main/java/org/json/JSONObject.java
I haven't investigated further.)

Note also the result on -0e0.

More importantly, the JSON specification so far has been mute on negative zeros (random quote from someone trying to interpret the specification: "The JSON specification allows that number, but does not define what it means"*).

(Going forward, it would probably be a good thing to recommend that JSON decoders represent all of -0, -0e0 etc. in a number representation that keeps negative zeros distinct; that is for most of them, treat -0 as a floating point value.  Examples of implementations that do so: Erlang's, JSONKit, demjson.)

Grüße, Carsten

*) http://deron.meranda.us/python/comparing_json_modules/numbers