Re: [Json] on serialization of signed zero

Phillip Hallam-Baker <ietf@hallambaker.com> Sun, 05 July 2015 18:54 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BFFAF1A009F for <json@ietfa.amsl.com>; Sun, 5 Jul 2015 11:54:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.277
X-Spam-Level:
X-Spam-Status: No, score=-1.277 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FM_FORGED_GMAIL=0.622, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-0.001] autolearn=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BRMLA4B8IWoL for <json@ietfa.amsl.com>; Sun, 5 Jul 2015 11:54:07 -0700 (PDT)
Received: from mail-la0-x229.google.com (mail-la0-x229.google.com [IPv6:2a00:1450:4010:c03::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 67ADD1A004B for <json@ietf.org>; Sun, 5 Jul 2015 11:54:07 -0700 (PDT)
Received: by lagx9 with SMTP id x9so131543686lag.1 for <json@ietf.org>; Sun, 05 Jul 2015 11:54:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=N3VKJEkQFjY5ay887/aNs+WwJvv6G1tZdkLYASiAKQI=; b=aBJU3pXwnL4UI9OPI4cRFmh/JtW3gda12zD7CHU0bzoUOcQmv1lcboMfIwF23RbJwQ oqfKjF7eVLkX6/CTBjYIxX3s2R6+AZfq6PPeqjDTtQfbdmj7Sn0wvUhbVX2CM0M5L7Gh CmFio+bDzfuS1pzEltutiNYAYjvCbqaw8jV8G9TKj+j68CIa/5fyj1cgiStdhDY3kgnv trhJougxdJOsVdt6eot+AXB/gC2GsDkd7odZlFh/VE6KYL4HcqX3QKMa9dJEvwbCMKSx dppfVftbbKIFyfdls7xvV8dUgzPA0YjWhqqfvAEu2ARZvQmDmn2/qB8xEeSjfr9Nward WiKg==
MIME-Version: 1.0
X-Received: by 10.112.172.4 with SMTP id ay4mr6102494lbc.124.1436122445738; Sun, 05 Jul 2015 11:54:05 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.112.203.163 with HTTP; Sun, 5 Jul 2015 11:54:05 -0700 (PDT)
In-Reply-To: <55996D2C.8050907@fastmail.net>
References: <55996D2C.8050907@fastmail.net>
Date: Sun, 05 Jul 2015 14:54:05 -0400
X-Google-Sender-Auth: WLwNHxp5oejFtB6DuRF9zmlLocg
Message-ID: <CAMm+LwizHhoYFQJyytKBSXR8Zn_nbiUQBdWxypa3C0NXtF0OUQ@mail.gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
To: Sonny Piers <sonny@fastmail.net>
Content-Type: multipart/alternative; boundary="001a11c345a83b7ac8051a255009"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/WIAkvseHLLXXRftIrg83yWJRp5s>
Cc: JSON WG <json@ietf.org>
Subject: Re: [Json] on serialization of signed zero
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
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: <https://mailarchive.ietf.org/arch/browse/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, 05 Jul 2015 18:54:08 -0000

Same as NaN, you can't.

I propose extending JSON with a binary encoding for that exact reason and
to allow the precision of binary numbers to be preserved. But this could
also be done using Hex.

On Sun, Jul 5, 2015 at 1:45 PM, Sonny Piers <sonny@fastmail.net> wrote:

>  Hello,
>
> Signed zeros are included in the IEEE floating point standard.
> From my understanding RFC 7159 doesn't forbid them.
> But both python and ECMAScript serialize signed zeros (-0) into "0".
>
> I wonder what would be the correct way of serializing them.
>
> Thanks.
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
>
>