Decimal.to_integer
to_integer
Group: Conversions
Documentation
Convert this to an Integer
. Conversion to Integer
uses truncation: the fractional portion is dropped. If the conversion resulted in a loss of precision, a Loss_Of_Numeric_Precision
warning is attached.
Examples
Convert Decimal
2345.6 to an Integer
.
d = Decimal.new "2345.6"
d.to_integer
# => 2345