Skip to main content

Decimal.div

divthat

Group: Math

Documentation

Computes the integer division of this by that.

Integer division of Decimals rounds down to the nearest integer. Arguments to div will undergo automatic conversions such that you need not convert other numeric types to Decimal manually.

Arguments

  • that: The number to divide this by.

Examples

Dividing 10 by 3 to get 3.

      Decimal.new "10" . div (Decimal.new "3")
# => 3

Dividing 10.28 by 3.01 to get 3.

      Decimal.new "10.28" . div (Decimal.new "3.01")
# => 3

Errors

  • If that is 0, div throws an Arithmetic_Error.