Operations on monetary amounts, including conversion, parsing, and predicates
Operations on monetary amounts, including conversion, parsing, and predicates
(< a)
(< a b)
(< a b & more)
Returns true if the given money amounts are in monotonically decreasing order, otherwise false.
Returns true if the given money amounts are in monotonically decreasing order, otherwise false.
(<= a)
(<= a b)
(<= a b & more)
Returns true if the given money amounts are in monotonically non-decreasing order, otherwise false.
Returns true if the given money amounts are in monotonically non-decreasing order, otherwise false.
(> a)
(> a b)
(> a b & more)
Returns true if the given money amounts are in monotonically decreasing order, otherwise false.
Returns true if the given money amounts are in monotonically decreasing order, otherwise false.
(>= a)
(>= a b)
(>= a b & more)
Returns true if the given money amounts are in monotonically non-increasing order, otherwise false.
Returns true if the given money amounts are in monotonically non-increasing order, otherwise false.
(abs money)
Takes absolute value of the given monetary amount
Takes absolute value of the given monetary amount
(amount-of unit amount)
(amount-of unit amount rm)
Instantiates a monetary amount of given currency unit and amount as double. N.B. this function should not be used for currencies without minor units (e.g. JPY).
Instantiates a monetary amount of given currency unit and amount as double. N.B. this function should not be used for currencies without minor units (e.g. JPY).
(op-divide multiplier money rounding-mode)
(op-minus other money rounding-mode)
(op-multiply multiplier money rounding-mode)
(op-plus other money rounding-mode)
(convert-to money currency multiplier rounding-mode)
Converts monetary amount in one currency to monetary amount in a different currency using the provided multiplier (exchange rate) and rounding mode.
Multiplier should be either a java.math.BigDecimal or a double.
Rounding mode should be one of:
Converts monetary amount in one currency to monetary amount in a different currency using the provided multiplier (exchange rate) and rounding mode. Multiplier should be either a java.math.BigDecimal or a double. Rounding mode should be one of: * java.math.RoundingMode instances * :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names * nil for no rounding
(currency-of money)
Returns the currency of a monetary amount
Returns the currency of a monetary amount
(divide money multiplier)
(divide money multiplier rounding-mode)
Divides monetary amount by the given number. Takes an optional arounding mode which is one of:
Divides monetary amount by the given number. Takes an optional arounding mode which is one of: * java.math.RoundingMode instances * :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names * nil for no rounding
(major-of money)
Returns the amount in major units as a long
Returns the amount in major units as a long
(max a)
(max a b)
(max a b & more)
Returns the greatest of the given money amounts
Returns the greatest of the given money amounts
(min a)
(min a b)
(min a b & more)
Returns the least of the given money amounts
Returns the least of the given money amounts
(minor-of money)
Returns the amount in minor units as a BigInt
Returns the amount in minor units as a BigInt
(minus money other)
Subtracts one monetary amount from another, taking one of them in major units (e.g. dollars)
Subtracts one monetary amount from another, taking one of them in major units (e.g. dollars)
(minus-major money amount)
Subtracts one monetary amount from another, taking one of them in minor units (e.g. cents)
Subtracts one monetary amount from another, taking one of them in minor units (e.g. cents)
(minus-minor money amount)
Subtracts one monetary amount from another
Subtracts one monetary amount from another
(multiply money multiplier)
(multiply money multiplier rounding-mode)
Multiplies monetary amount by the given number. Takes an optional arounding mode which is one of:
Multiplies monetary amount by the given number. Takes an optional arounding mode which is one of: * java.math.RoundingMode instances * :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names * nil for no rounding
(negated money)
Negates the given monetary amount
Negates the given monetary amount
(negative-or-zero? money)
Returns true if the given monetary amount is negative or zero
Returns true if the given monetary amount is negative or zero
(negative? money)
Returns true if the given monetary amount is negative
Returns true if the given monetary amount is negative
(of-major unit amount)
Instantiates a monetary amount of given currency unit and major unit amount. This function should be used for currencies without minor units (e.g. JPY).
Instantiates a monetary amount of given currency unit and major unit amount. This function should be used for currencies without minor units (e.g. JPY).
(of-minor unit amount)
Instantiates a monetary amount of given currency unit and minor unit amount. This function can be used for currencies without minor units (e.g. JPY), in which case it's going to work just as of-major.
Instantiates a monetary amount of given currency unit and minor unit amount. This function can be used for currencies without minor units (e.g. JPY), in which case it's going to work just as of-major.
(parse s)
Parses a string in the format of [currency code] [amount as double] (e.g. GBP 20.00) and returns a monetary amount.
Parses a string in the format of [currency code] [amount as double] (e.g. GBP 20.00) and returns a monetary amount.
(plus money other)
Adds two monetary amounts together
Adds two monetary amounts together
(plus-major money amount)
Adds two monetary amounts together, taking one of them in major units (e.g. dollars)
Adds two monetary amounts together, taking one of them in major units (e.g. dollars)
(plus-minor money amount)
Adds two monetary amounts together, taking one of them in minor units (e.g. cents)
Adds two monetary amounts together, taking one of them in minor units (e.g. cents)
(positive-or-zero? money)
Returns true if the given monetary amount is positive or zero
Returns true if the given monetary amount is positive or zero
(positive? money)
Returns true if the given monetary amount is positive
Returns true if the given monetary amount is positive
(round money scale rounding-mode)
Rounds monetary amount using the given scale and rounding mode.
Scale is one of -1, 0, 1, 2, 3 but no greater than the currency's scale.
Rounding mode should be one of:
Rounds monetary amount using the given scale and rounding mode. Scale is one of -1, 0, 1, 2, 3 but no greater than the currency's scale. Rounding mode should be one of: * java.math.RoundingMode instances * :floor, :ceiling, :up, :down, :half-up, :half-down, :half-even that correspond to java.math.RoundingMode constants with the same names * nil for no rounding
(total monies)
Sums up multiple monetary amounts
Sums up multiple monetary amounts
(zero unit)
Returns zero monetary amount for the given currency unit
Returns zero monetary amount for the given currency unit
(zero? money)
Returns true if the given monetary amount is zero
Returns true if the given monetary amount is zero
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close