NumEx v0.1.0 Decimal_ View Source
A module to perform operations on decimal values
Link to this section Summary
Functions
Takes a Decimal value and returns its absolute value
Takes two Decimal values and compares them; returns “-1” if the first element is less than the second, “1” if it is greater and “0” if the elements are equal
Takes two Decimal values and compares them; returns “-1” if the first element is less than the second, “1” if it is greater and “0” if the elements are equal. However it helps comparing values like 1 and 1.0
Takes three decimal values and performs fast multiplication and addition i.e, for the arguments i, j, k the function returns the value i * j + k
Takes a Decimal value and returns if the value is signed
Link to this section Functions
Takes a Decimal value and returns its absolute value
Examples
iex> Decimal_.abs(15)
15
iex> Decimal_.abs(-32)
32
Takes two Decimal values and compares them; returns “-1” if the first element is less than the second, “1” if it is greater and “0” if the elements are equal
Examples
iex> Decimal_.compare(1, 5)
-1
iex> Decimal_.compare(1, -5)
1
iex> Decimal_.compare(4, 4)
0
compare_total(integer(), integer()) :: integer()
Takes two Decimal values and compares them; returns “-1” if the first element is less than the second, “1” if it is greater and “0” if the elements are equal. However it helps comparing values like 1 and 1.0
Examples
iex> Decimal_.compare_total(1, 5)
-1
iex> Decimal_.compare_total(1, -5)
1
iex> Decimal_.compare_total(4, 4)
0
iex> Decimal_.compare_total(1, 1.0)
-1
Takes three decimal values and performs fast multiplication and addition i.e, for the arguments i, j, k the function returns the value i * j + k
Examples
iex> Decimal_.fma(2, 3, -5)
1