The Currency Airkit type is used to represent a given amount of currency. It
pairs a Number with a currency unit (for example "USD" or "JPY"), and a
precision. The precision is used to determine how many decimal places to
include. For example if the currency unit is "USD" and the precision is 2,
then the Currency value is represented in US cents.
It is important to use the Currency type rather than a Number because there are
rounding errors when working with decimal Numbers. For example the result of
0.1 + 0.2 is not 0.3 but rather 0.30000000000000004.
Was this article helpful?
0 out of 0 found this helpful