Re: [Json] -0.0

John Cowan <cowan@mercury.ccil.org> Thu, 26 September 2013 19:36 UTC

Return-Path: <cowan@ccil.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 0DAA821E80BA for <json@ietfa.amsl.com>; Thu, 26 Sep 2013 12:36:37 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.228
X-Spam-Level:
X-Spam-Status: No, score=-3.228 tagged_above=-999 required=5 tests=[AWL=0.371, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
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 kFnxqGyb1YOk for <json@ietfa.amsl.com>; Thu, 26 Sep 2013 12:36:32 -0700 (PDT)
Received: from earth.ccil.org (earth.ccil.org [192.190.237.11]) by ietfa.amsl.com (Postfix) with ESMTP id 3BC1D21F9CC6 for <json@ietf.org>; Thu, 26 Sep 2013 12:36:31 -0700 (PDT)
Received: from cowan by earth.ccil.org with local (Exim 4.72) (envelope-from <cowan@ccil.org>) id 1VPHMS-0003Y9-Di; Thu, 26 Sep 2013 15:36:28 -0400
Date: Thu, 26 Sep 2013 15:36:28 -0400
From: John Cowan <cowan@mercury.ccil.org>
To: Tim Bray <tbray@textuality.com>
Message-ID: <20130926193628.GB8186@mercury.ccil.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> <CAChr6SzPeOoeJd1z1VNHTk1Jk+3zUY=D2AcboGxYtphYHOCdjw@mail.gmail.com> <CAHBU6iu1LrpvTQc12cvO+8uCVdvE7d6p_jsBUKQ1qi1peFfHNw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAHBU6iu1LrpvTQc12cvO+8uCVdvE7d6p_jsBUKQ1qi1peFfHNw@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Sender: John Cowan <cowan@ccil.org>
Cc: JSON WG <json@ietf.org>, Paul Hoffman <paul.hoffman@vpnc.org>, R S <sayrer@gmail.com>
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: Thu, 26 Sep 2013 19:36:38 -0000

Tim Bray scripsit:

> Hm, I bet that there are languages that look at the JSON number and
> if there's no exp or frac parts, jam it into an integer; do modern
> *integer* implementations preserve negative zero?

By definition, no language that provides a exact representation of
numbers (whether fixed-point or integral) can differentiate 0 and -0.
It is because floating-point values represent *ranges* of numbers that
it makes sense to differentiate between too-small numbers that cannot
be negative (0.0) and too-large numbers that cannot be positive (-0.0).

-- 
John Cowan  cowan@ccil.org  http://ccil.org/~cowan
The competent programmer is fully aware of the strictly limited size of his own
skull; therefore he approaches the programming task in full humility, and among
other things he avoids clever tricks like the plague.  --Edsger Dijkstra