moneyex v0.1.0 Money

Convert floats, strings or integers in to integer representation of a number with decimals.

Summary

Functions

Add two values and return an integer representation of a float

Convert a value in to an integer representation of a float

Divide two values and return an integer representation of a float

Multiply two values and return an integer representation of a float

Subtract two values and return an integer representation of a float

Convert to float an integer representation of a float

Convert to float string an integer representation of a float

Functions

add(amount_1, amount_2)
add(integer | float | String.t, integer | float | String.t) :: integer

Add two values and return an integer representation of a float

convert_to_integer(amount)
convert_to_integer(float) :: integer
convert_to_integer(integer | String.t) :: integer

Convert a value in to an integer representation of a float.

Example:

10 -> 1000

“10.00” -> 1000

10.00 -> 1000

If we are using a scale of four:

10.0000 -> 100000

divide(amount_1, amount_2)
divide(integer | float | String.t, integer | float | String.t) :: integer

Divide two values and return an integer representation of a float

multiply(amount_1, amount_2)
multiply(integer | float | String.t, integer | float | String.t) :: integer

Multiply two values and return an integer representation of a float

subtract(amount_1, amount_2)
subtract(integer | float | String.t, integer | float | String.t) :: integer

Subtract two values and return an integer representation of a float

to_float(amount)
to_float(integer) :: float

Convert to float an integer representation of a float

to_string(amount)
to_string(integer) :: String.t

Convert to float string an integer representation of a float