Re: [Json] -0.0

Peter Patel-Schneider <pfpschneider@gmail.com> Sun, 29 September 2013 22:45 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 8E18E21F894E for <json@ietfa.amsl.com>; Sun, 29 Sep 2013 15:45:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, NO_RELAYS=-0.001]
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 9m-yqGXRd-0m for <json@ietfa.amsl.com>; Sun, 29 Sep 2013 15:45:23 -0700 (PDT)
Received: from mail-qc0-x22b.google.com (mail-qc0-x22b.google.com [IPv6:2607:f8b0:400d:c01::22b]) by ietfa.amsl.com (Postfix) with ESMTP id A6FAB11E8149 for <json@ietf.org>; Sun, 29 Sep 2013 15:45:21 -0700 (PDT)
Received: by mail-qc0-f171.google.com with SMTP id x19so3107974qcw.16 for <json@ietf.org>; Sun, 29 Sep 2013 15:45:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=IZ1m4j0QsVLBdGWaQW4sJrq99Vuo4jOlank2EyeUjUc=; b=HN5omBuMPmPM88bfwHOpV0SketuUgUIytCcxebJysaFOZrD8VK/Q1S+WXthdpm6k8d YlRdWONZOknxGcwb7AyLnK+iET/yqDiwP2NKNIXW59Q0kKiwpOM6cKX0w5RPIjpOhLD/ kmzzXaJOfEgF3HCwNDTeexr2Hb4tZZBpBmfZhrkhaS0kVJbaMLXNbnAPkh4gvQAJkJCT zugJZYt/p8h8c3oqL/OSuK9+a8qShPqP7Y8JbJeTmRE4VEU4pzTQFcmYomWJEnhzlWjC O6JRRzpy1ot3Q4BwzNTMtTbSwhtHLZVc81iGZHh92wmTC0cbkOpPAThSDrVhUDYFv6fo i5Lg==
MIME-Version: 1.0
X-Received: by 10.49.58.174 with SMTP id s14mr25073116qeq.73.1380494720842; Sun, 29 Sep 2013 15:45:20 -0700 (PDT)
Received: by 10.49.64.202 with HTTP; Sun, 29 Sep 2013 15:45:20 -0700 (PDT)
In-Reply-To: <CAHBU6is6w6WpsYOeOP=yMREAhz90+J4OPC6uVB+nXca2aJMmpg@mail.gmail.com>
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> <9D959999-63A2-46EF-8C14-C48F586D9DA4@tzi.org> <CAChr6Sz4Hg--YrWnxXOxJJmbx=AmjDoEZXxs7HeTV58w5VSRDg@mail.gmail.com> <25C6CA6F-76F0-42DE-8845-850B8B69F1A6@tzi.org> <CAHBU6is6w6WpsYOeOP=yMREAhz90+J4OPC6uVB+nXca2aJMmpg@mail.gmail.com>
Date: Sun, 29 Sep 2013 15:45:20 -0700
Message-ID: <CAMpDgVxCTKVm4h8RvFPJ-24umbsrL-M9k1a1RYdoKG7yW7AGDw@mail.gmail.com>
From: Peter Patel-Schneider <pfpschneider@gmail.com>
To: Tim Bray <tbray@textuality.com>
Content-Type: multipart/alternative; boundary="047d7b6d8afc733fe804e78d7987"
Cc: Carsten Bormann <cabo@tzi.org>, R S <sayrer@gmail.com>, 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 22:45:24 -0000

Hmm.   Many other languages, for example C, are not adequately specific
concerning the interpretation of floating point constants, particularly -0.0

However, I don't know of any language or formalism that is used in a way
that is so cavalier about the interpretation of numeric constants in
general, so I would have to say that the breadth of the problems with -0
are specific to JSON.  In all the other languages and formalisms that I
have used -0 is integer 0, and thus the same as 0, and this has been
explicitly or implicitly stated in the definition of the language or
formalism.  Even C with one's complement integers should get this right,
although direct casting to unsigned integers might expose the existence of
signed zeros.

Peter F. Patel-Schneider
Nuance Communications

PS:  Yes, yes, I expect that there are *many* languages and formalisms that
are just as bad as JSON with respect to numbers.  I just haven't had the
displeasure of needing to work with any of them yet.



On Sun, Sep 29, 2013 at 1:46 PM, Tim Bray <tbray@textuality.com> wrote:

> Yeah, but my opinion is shifting here... it's starting to feel to me like
> there's nothing remotely JSON-specific about the problems around -0.  Let
> me see, if I were going to do another draft based on what people have been
> saying here, I'd, in Section 6
>
> - Remove "are represented without "frac" or "exp" parts (for example as 3
> not 3.0)"
> - Lose the whole paragraph beginning "Numbers which represent zero without
> a sign...
>
> Less is more. Is anyone passionate about keeping either?
>
>  -T
>
>
> On Sun, Sep 29, 2013 at 1:33 PM, Carsten Bormann <cabo@tzi.org> wrote:
>
>> On Sep 29, 2013, at 22:25, R S <sayrer@gmail.com> wrote:
>>
>> > I am not sure that file is relevant
>>
>> It is an example of an implementation that encodes a floating point
>> negative zero as »-0«, which is then decoded as a plain (integer) zero by
>> most implementations.
>>
>> Summary: If you want wide interoperability, don't rely on negative zero
>> (in any form) staying distinct.  (And if you don't need wide
>> interoperability, the encoded form »-0.0« appears to survive best.)
>>
>> Grüße, Carsten
>>
>> _______________________________________________
>> json mailing list
>> json@ietf.org
>> https://www.ietf.org/mailman/listinfo/json
>>
>
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>
>