Re: [Cbor] Proposal for Currency and Money Amount

Richter, Jörg <Joerg.Richter@pdv-FS.de> Fri, 15 February 2019 08:04 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 B9AD6129A87 for <cbor@ietfa.amsl.com>; Fri, 15 Feb 2019 00:04:19 -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 Y0cYILqxbCvP for <cbor@ietfa.amsl.com>; Fri, 15 Feb 2019 00:04:17 -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 13E6812867A for <cbor@ietf.org>; Fri, 15 Feb 2019 00:04:16 -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; Fri, 15 Feb 2019 09:04:13 +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; Fri, 15 Feb 2019 09:04:13 +0100
From: "Richter, Jörg" <Joerg.Richter@pdv-FS.de>
To: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
CC: "cbor@ietf.org" <cbor@ietf.org>
Thread-Topic: [Cbor] Proposal for Currency and Money Amount
Thread-Index: AdTEPd7oTfrVqiXQS9Se27nRqE1bOQALe6qAACW1ThA=
Date: Fri, 15 Feb 2019 08:04:13 +0000
Message-ID: <cc7d04e6db734627875e537d4b83ee49@pdv-FS.de>
References: <41655d71b9414fb7891487d0123e1b61@pdv-FS.de> <20190214144719.GA1404@meili>
In-Reply-To: <20190214144719.GA1404@meili>
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/ES7pVtF_K28M1APUW7EvxIBdUeQ>
Subject: Re: [Cbor] Proposal for Currency and Money Amount
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: Fri, 15 Feb 2019 08:04:20 -0000

> Should this support non-decimal currency amounts?
> As far as I can tell, the only currently in use non-decimal currency is
> the Mauritania's ouguiya (ISO 4217: MRU & 929) which uses 1 ouguiya = 5 khoums
> ...
> (I suppose the simplest solution to allowing non-decimal currencies would be
> to make the array 2 or more elements.  The currency code tells the consumer
> how to render the encoded values.)

I would be very surprised if software would store values of this
currency not with fractions 0.0, 0.2, 0.4, 0.6 or 0.8.

Many calculations with amounts also use more decimal places than
the currency defines.  So there is a need to store a fraction of the smallest unit.
One daily live example would be petrol prices in Germany that have 3 decimal 
places instead of the 2 that the Euro defines.  
Some applications even require non-decimal fractions like 1/3.

This is of course representable with just one number.

Just the final presentation step would convert from a number to a pair of 
ouguiya and khoum.  But according to Wikipedia even this currency is printed 
in decimal:

> The Malagasy ariary and the Mauritanian ouguiya are technically divided 
> into five subunits (the iraimbilanja and khoum respectively) the coins 
> display "1/5" on their face and are referred to as a "fifth" (Khoum/cinquième); 
> These are not used in practice, but when written out, a single significant digit 
> is used. E.g. 1.2 UM.

- Jörg