Quantity v0.4.0 Quantity.Sigils View Source

Sigils related to Quantity and Decimal

Link to this section Summary

Functions

Construct a Quantity

Construct a Decimal

Link to this section Functions

Link to this function

sigil_Q(input, list)

View Source
sigil_Q(String.t(), []) :: Quantity.t()

Construct a Quantity

iex> ~Q[12.340 kwh] Quantity.new(~d[12.340], "kwh")

iex> ~Q[15 $/banana] Quantity.new(~d[15], {:div, "$", "banana"})

iex> ~Q[12.34 m*m] Quantity.new(~d[12.34], {:mult, "m", "m"})

Link to this function

sigil_d(input, list)

View Source
sigil_d(String.t(), []) :: Decimal.t()

Construct a Decimal

iex> ~d[12.340] Decimal.new("12.340")