currencygithub.com/castedo/isomon

Money Library

isomon::money = IEEE 754 double - exponent + ISO 4217 currency code

Features

The easiest way to use the isomon::money and isomon::money_calc classes is to copy this single unified header: isomon_money.hpp.

If you want to edit the files or build unit or performance tests, you should make a clone of the git source code repository.

isomon::money

namespace isomon {
  class money;

  template<typename _Number> struct number_traits;

  template<> struct number_traits<double>;
  bool isfinite(money m);
  money operator*(int32_t i, money m);
  template<typename _Number> money floor(_Number value, currency unit);
  template<typename _Number> money ceil(_Number value, currency unit);
  template<typename _Number> money trunc(_Number value, currency unit);
  template<typename _Number> money round(_Number value, currency unit);
  template<typename _Number> money rounde(_Number value, currency unit);
  std::ostream & operator<<(std::ostream & os, money m);
  money nextafter(money m);
}

isomon::money_calc

namespace isomon {
  template<typename _Number> struct money_calc;

  template<> struct money_calc<double>;

  typedef money_calc< double > money_double;
  bool operator>(money m, money_calc< double > mc);
  bool operator>=(money m, money_calc< double > mc);
  bool operator<(money m, money_calc< double > mc);
  bool operator<=(money m, money_calc< double > mc);
  bool isfinite(money_calc< double > const & mc);
  money_calc< double > operator+(money m, double x);
  money_calc< double > operator+(double x, money m);
  money_calc< double > operator+(double x, money_calc< double > mc);
  money_calc< double > operator+(money m, money_calc< double > mc);
  money_calc< double > operator-(money m, double x);
  money_calc< double > operator-(double x, money m);
  money_calc< double > operator-(double x, money_calc< double > mc);
  money_calc< double > operator-(money m, money_calc< double > mc);
  money_calc< double > operator*(money m, double x);
  money_calc< double > operator*(double x, money_calc< double > mc);
  money_calc< double > operator*(double x, money m);
  money_calc< double > operator/(money m, double x);
  template<typename _Number> money floor(money_calc< _Number > const & mc);
  template<typename _Number> money ceil(money_calc< _Number > const & mc);
  template<typename _Number> money trunc(money_calc< _Number > const & mc);
  template<typename _Number> money round(money_calc< _Number > const & mc);
  template<typename _Number> money rounde(money_calc< _Number > const & mc);
}

Other Money (or Decimal) Classes