module Money::Casting
Direct including types
Defined in:
money/money/casting.crInstance Method Summary
-
#to_big_d : BigDecimal
Returns the amount of money as a
BigDecimal
. -
#to_big_f : BigFloat
Returns the amount of money as a
BigFloat
.
Instance Method Detail
def to_big_d : BigDecimal
#
Returns the amount of money as a BigDecimal
.
Money.us_dollar(1_00).to_big_d # => BigDecimal.new("1.00")
def to_big_f : BigFloat
#
Returns the amount of money as a BigFloat
. Floating points cannot guarantee
precision. Therefore, this function should only be used when you no longer
need to represent currency or working with another system that requires
floats.
Money.us_dollar(100).to_big_f # => 1.0