Kernel.div

You're seeing just the function div, go back to Kernel module for more information.

Specs

div(integer(), neg_integer() | pos_integer()) :: integer()

Performs an integer division.

Raises an ArithmeticError exception if one of the arguments is not an integer, or when the divisor is 0.

div/2 performs truncated integer division. This means that the result is always rounded towards zero.

If you want to perform floored integer division (rounding towards negative infinity), use Integer.floor_div/2 instead.

Allowed in guard tests. Inlined by the compiler.

Examples

div(5, 2)
#=> 2

div(6, -4)
#=> -1

div(-99, 2)
#=> -49

div(100, 0)
** (ArithmeticError) bad argument in arithmetic expression