Re: [netmod] Justification for decimal64 over string for floating point values in geo location data?
Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Tue, 07 July 2020 11:24 UTC
Return-Path: <j.schoenwaelder@jacobs-university.de>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 335BE3A0B60 for <netmod@ietfa.amsl.com>; Tue, 7 Jul 2020 04:24:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=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 i34XZH_BBGn4 for <netmod@ietfa.amsl.com>; Tue, 7 Jul 2020 04:24:55 -0700 (PDT)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 00FF73A0B5F for <netmod@ietf.org>; Tue, 7 Jul 2020 04:24:53 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id 7947A87D; Tue, 7 Jul 2020 13:24:51 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.198]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id QQfEzEQzHxjC; Tue, 7 Jul 2020 13:24:51 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "DFN-Verein Global Issuing CA" (verified OK)) by atlas5.jacobs-university.de (Postfix) with ESMTPS; Tue, 7 Jul 2020 13:24:51 +0200 (CEST)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by hermes.jacobs-university.de (Postfix) with ESMTP id 3C0DA20154; Tue, 7 Jul 2020 13:24:51 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10028) with ESMTP id AAP90-jQ5GsY; Tue, 7 Jul 2020 13:24:50 +0200 (CEST)
Received: from localhost (anna.jacobs.jacobs-university.de [10.50.218.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by hermes.jacobs-university.de (Postfix) with ESMTPS id CE874200E4; Tue, 7 Jul 2020 13:24:50 +0200 (CEST)
Date: Tue, 07 Jul 2020 13:24:50 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Christian Hopps <chopps@chopps.org>
Cc: NetMod WG <netmod@ietf.org>
Message-ID: <20200707112450.wrttuprwrdr3nl5i@anna.jacobs.jacobs-university.de>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Christian Hopps <chopps@chopps.org>, NetMod WG <netmod@ietf.org>
References: <B548C4B4-2A97-4736-A6B2-358D1491D125@chopps.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <B548C4B4-2A97-4736-A6B2-358D1491D125@chopps.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/otYOGDgbJ5Hx8sd9C5kS-hMmBL0>
Subject: Re: [netmod] Justification for decimal64 over string for floating point values in geo location data?
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 07 Jul 2020 11:24:57 -0000
Precision often means different things to different people. Here is my take: - Floating point numbers have almost always rounding errors. And floating point numbers use binary fractions, a decimal fraction like 1.0 has no precise representation as a binary fraction. Type 0.1 + 0.2 into python or haskell or any other language that gives you bare floating point numbers and enjoy the result. - Fixed precision decimal numbers do not have rounding errors since they are essentially scaled integers and hence they are precise as long as calculations stay within the range. - Floating point numbers can cover a large number space (from very tiny to really big), fixed precision decimal numbers are much more restrictive. - In XML and JSON, numbers are rendered in strings that likely do not look much different if its a decimal64 or a float or ... If you really care about size, use a binary encoding like CBOR. /js On Tue, Jul 07, 2020 at 07:06:20AM -0400, Christian Hopps wrote: > I received feedback in my YANG doctor review (thanks Mahesh) regarding the use of decimal64 for most of the values in the geo location grouping (https://tools.ietf.org/html/draft-ietf-netmod-geo-location-04). In my comparison sections I note that some precision (at the very extremes) may be lost when converting from other geo location formats that use string (or double for w3c) to decimal64. Given that mention of loss of extreme precision, the reviewer was asking if some justification for the decimal64 should be given in the document. > > What are the advantages to using decimal64 for floating point numbers vs using a string with a pattern "[0-9]+(\.[0-9]+)?" (convert that to yang pattern language). The advantage of using a string is that the precision of the value is not restricted by the model. Does the YANG decimal64 values have a concise binary format that can be more efficiently transported or stored in binary form? If so is this the only advantage, and is it enough of one to limit the precision in the model? > > It's definitely worth noting that the precision of the decimal64 values seem vastly adequate for geo location data (e.g., for Cartesian coordinates and height values which are measured in meters the fractional digits is 6 which means the surface could be up to 9 billion kilometers large (or away from for height) and the precision is to the micrometer. For ellipsoidal coordinates there are 12 fractional digits for the degrees. > > Thanks, > Chris. > _______________________________________________ > netmod mailing list > netmod@ietf.org > https://www.ietf.org/mailman/listinfo/netmod -- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1 | 28759 Bremen | Germany Fax: +49 421 200 3103 <https://www.jacobs-university.de/>
- [netmod] Justification for decimal64 over string … Christian Hopps
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… Ladislav Lhotka
- Re: [netmod] Justification for decimal64 over str… Christian Hopps
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… Christian Hopps
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… Christian Hopps
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… Ladislav Lhotka
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… David Spakes
- Re: [netmod] Justification for decimal64 over str… Ladislav Lhotka
- Re: [netmod] Justification for decimal64 over str… Rob Wilton (rwilton)
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… Rob Wilton (rwilton)
- Re: [netmod] Justification for decimal64 over str… Juergen Schoenwaelder
- Re: [netmod] Justification for decimal64 over str… Carsten Bormann
- Re: [netmod] Justification for decimal64 over str… Rob Wilton (rwilton)
- Re: [netmod] Justification for decimal64 over str… Don Fedyk