Subject: [Cbor] Proposal for Currency and Money Amount

From: Richter, Jörg <[email-masked]>
Date: Thu, 14 Feb 2019 08:31:10 +0000

Here is a proposal to assign tags to currency and money amount:
https://j-richter.github.io/CBOR/currency.html

I have used tags 164/165. Code 164 is “CURRENCY SIGN” in Latin1. Not that it matters.
I think there is no reason to use shorter tags here, as currencies are
rarely transferred/saved alone.
Amounts of money are long enough that no shorter tag is worth it.

It is possible to use only one tag for both applications. But I think the
semantic difference is big enough that two tags are justified.

---

From: Josef 'Jeff' Sipek <[email-masked]>
Date: Thu, 14 Feb 2019 09:47:19 -0500

> https://j-richter.github.io/CBOR/currency.html

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 [1].

There are a number of historical currencies that were non-decimal, but I
suppose most (all?) of them are irrelevant since they don't have an ISO code.

(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.)

Thanks,

Jeff, who doesn't actually have a use for non-decimal currency support in CBOR.

[1] https://en.wikipedia.org/wiki/Non-decimal_currency#Contemporary_non-decimal_currencies

> _______________________________________________
> CBOR mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/cbor

-- 
Fact: 23.6% of all statistics are generated randomly.

---

From: Richter, Jörg <[email-masked]>
Date: Fri, 15 Feb 2019 08:04:13 +0000

> 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 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

---

From: Josef 'Jeff' Sipek <[email-masked]>
Date: Fri, 15 Feb 2019 07:08:07 -0500

> This is of course representable with just one number.

Yeah, that's fair.  The pre-decimal "GBP" which, according to wikipedia, was
'divided into 20 shillings and each shilling into 12 pence, making 240 pence
to the pound' would be much harder to wedge into a "one number format".

Given the use of ISO 4217, I'm happy with the proposal as is (for whatever
it's worth) without having explicit support for historical currencies.

Jeff.

-- 
Reality is merely an illusion, albeit a very persistent one.
		- Albert Einstein