DarkMatter v1.0.0 DarkMatter.Decimals.Conversion View Source

Decimal conversion functions

Link to this section Summary

Functions

Compare Decimal

Determines if two decimals are equivalent.

((n + (factor/2)) / factor) * factor

Generic to integer function

Transform a t:stringable.t/0 into a normalized exponent string.

Link to this section Types

Specs

stringable() :: nil | String.t() | Decimal.t()

Link to this section Functions

Link to this function

cast_decimal(decimal, mode \\ :reduced)

View Source

Cast Decimal

Link to this function

cast_decimal!(numeric, mode \\ :reduced)

View Source

Cast Decimal

Link to this function

cast_decimal_ok(numeric, mode \\ :reduced)

View Source

Cast Decimal ok

Compare Decimal

Determines if two decimals are equivalent.

Link to this function

decimal_round_ok(amount, list)

View Source

((n + (factor/2)) / factor) * factor

Generic to integer function

Specs

to_string(stringable()) :: nil | String.t()

Transform a t:stringable.t/0 into a normalized exponent string.

Raises ArgumentError if a given binary isn't a valid Decimal.

Link to this function

to_string(decimal, atom)

View Source