money 0.1.0

A money data type, for easy and safe handling of currency amounts


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

D-Money

Provide a money data type, for easy and safe handling of currency amounts.

Floating point is imprecise. Integer is fragile. Both lack convenience, e.g. for rounding.

Features:

  • support different rounding modes
  • cannot mix currencies (e.g. EUR vs USD)
  • efficient (faster than BigNum)
  • overflow checking for arithmetic

Scope is smaller than JSR 354, for example, which also considers conversion and meta data. A conversion rate depends on target date and time, the currencies involved, the provider, the amount, and other factors. If you need meta data, then wrap money into your own data type.

Internally, this uses a long data type. This limits the numbers depending on the number of decimals specified. A plain money!"EUR" type has a max of 922337203685477.5807EUR, roughly 922 trillion.

Authors:
Dependencies:
none
Versions:
3.0.2 2021-Jun-10
3.0.1 2020-Jun-08
3.0.0 2020-Jun-06
2.5.0 2020-May-29
2.4.0 2020-May-28
Show all 14 versions
Download Stats:
  • 5 downloads today

  • 135 downloads this week

  • 518 downloads this month

  • 54497 downloads total

Score:
3.9
Short URL:
money.dub.pm