Skip to content

Commit

Permalink
Change XXX.minorUnits to 0 (#33)
Browse files Browse the repository at this point in the history
Motivation:

ISO 4217 leaves the 'minorUnits' or 'exponent' of several currencies as 'undefined'. For example, both XTS and XXX have no specified value.

XTS was given the value of '1' arbitrarily for the purposes of testing rounding behaviors, while XXX should be 0 as "no currency" is used
in transactions with XXX.

Modification:

- Change: `XXX.minorUnits` to be `0`

Result:

`XXX` currency values should now be whole number representations.
  • Loading branch information
Mordil authored Feb 29, 2020
1 parent 103770f commit cecf3a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Resources/ISO4217.csv
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ LESOTHO,Rand,ZAR,710,2,,
ZAMBIA,Zambian Kwacha,ZMW,967,2,,
ZIMBABWE,Zimbabwe Dollar,ZWL,932,2,,
,Code reserved for testing,XTS,963,1,,
,No currency,XXX,999,2,,
,No currency,XXX,999,0,,
2 changes: 1 addition & 1 deletion Sources/Currency/ISOCurrencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,7 @@ public struct XXX: CurrencyProtocol, CurrencyMetadata {
public static var name: String { return "No currency" }
public static var alphabeticCode: String { return "XXX" }
public static var numericCode: UInt16 { return 999 }
public static var minorUnits: UInt8 { return 2 }
public static var minorUnits: UInt8 { return 0 }

public var minorUnits: Int64 { return self._minorUnits }

Expand Down

0 comments on commit cecf3a7

Please sign in to comment.