Re: [Cbor] Money amounts

Richter, Jörg <Joerg.Richter@pdv-FS.de> Wed, 27 February 2019 14:01 UTC

Return-Path: <Joerg.Richter@pdv-FS.de>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 78440130FDA for <cbor@ietfa.amsl.com>; Wed, 27 Feb 2019 06:01:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.921
X-Spam-Level:
X-Spam-Status: No, score=-0.921 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FROM_EXCESS_BASE64=0.979] autolearn=no 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 sDVlZTMBtuah for <cbor@ietfa.amsl.com>; Wed, 27 Feb 2019 06:01:05 -0800 (PST)
Received: from mail.pdv-fs.de (mail.pdv-fs.de [213.208.220.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D2878130ED9 for <cbor@ietf.org>; Wed, 27 Feb 2019 06:01:04 -0800 (PST)
Received: from EXCHDB1.pdv-fs.de (192.168.180.94) by EXCHDB1.pdv-fs.de (192.168.180.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 27 Feb 2019 15:01:01 +0100
Received: from EXCHDB1.pdv-fs.de ([fe80::6c4a:8b1b:60f4:4437]) by EXCHDB1.pdv-fs.de ([fe80::6c4a:8b1b:60f4:4437%15]) with mapi id 15.01.1466.012; Wed, 27 Feb 2019 15:01:01 +0100
From: "Richter, Jörg" <Joerg.Richter@pdv-FS.de>
To: Changaco <changaco=40changaco.oy.lc@dmarc.ietf.org>, "cbor@ietf.org" <cbor@ietf.org>
Thread-Topic: [Cbor] Money amounts
Thread-Index: AQHUzOx92SDKrErmaU2DctY4qiZ6Z6XwMeIAgAARnwCAABUloIADMC+AgAAgXJA=
Date: Wed, 27 Feb 2019 14:01:00 +0000
Message-ID: <a315fa222d0540ecb96a45071f4cf74a@pdv-FS.de>
References: <20190225102821.583b57b9.changaco@changaco.oy.lc> <A996325B-9D87-4537-87B4-59CD40F56FF2@tzi.org> <20190225114418.5eaea1dd.changaco@changaco.oy.lc> <f2fde9b2c8f54d9691b0933e7818b90c@pdv-FS.de> <20190227134113.3dd82f19.changaco@changaco.oy.lc>
In-Reply-To: <20190227134113.3dd82f19.changaco@changaco.oy.lc>
Accept-Language: de-DE, en-US
Content-Language: de-DE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [192.168.180.93]
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/6NJC4Jf_thfOpvflc3eR4anv6RQ>
Subject: Re: [Cbor] Money amounts
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Feb 2019 14:01:12 -0000

> I think it's best to be lossless by default. If an encoder receives a
> `10.00`, for example a `Decimal('10.00')` object in Python, then it should
> encode the trailing zeroes unless it has been explicitly configured to
> drop them.

Then this problem is independent of money amounts.  But I am not sure if
CBOR allows 4([-2,100]) and 4([-1,10]) and 1 to have different semantics.

If this should be the case for money amounts than we should use the map
to store the number of digits (or the exponent).

- Jörg