ESpec v1.6.0 Integer.Extension View Source

A module to extend the calendar implementation that follows to ISO8601 with methods found in Elixir 1.5.1. This is to allow ESpec to support Elixir >= 1.3.4 more easily.

Link to this section Summary

Functions

Performs a floored integer division

Link to this section Functions

Link to this function floor_div(dividend, divisor) View Source
floor_div(integer(), neg_integer() | pos_integer()) :: integer()

Performs a floored integer division.

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

Integer.floor_div/2 performs floored integer division. This means that the result is always rounded towards negative infinity.

If you want to perform truncated integer division (rounding towards zero), use Kernel.div/2 instead.

Examples

iex> Integer.floor_div(5, 2)
2
iex> Integer.floor_div(6, -4)
-2
iex> Integer.floor_div(-99, 2)
-50