Float.floor

You're seeing just the function floor, go back to Float module for more information.
Link to this function

floor(number, precision \\ 0)

View Source

Specs

floor(float(), precision_range()) :: float()

Rounds a float to the largest number less than or equal to num.

floor/2 also accepts a precision to round a floating-point value down to an arbitrary number of fractional digits (between 0 and 15). The operation is performed on the binary floating point, without a conversion to decimal.

This function always returns a float. Kernel.trunc/1 may be used instead to truncate the result to an integer afterwards.

Known issues

The behaviour of floor/2 for floats can be surprising. For example:

iex> Float.floor(12.52, 2)
12.51

One may have expected it to floor to 12.52. This is not a bug. Most decimal fractions cannot be represented as a binary floating point and therefore the number above is internally represented as 12.51999999, which explains the behaviour above.

Examples

iex> Float.floor(34.25)
34.0
iex> Float.floor(-56.5)
-57.0
iex> Float.floor(34.259, 2)
34.25