floorValue.php
Table of Contents
Functions
- floorValue() : float
- Rounds a number down to a count of decimal places.
Functions
floorValue()
Rounds a number down to a count of decimal places.
floorValue(int|float $value[, int $floatCount = 0 ]) : float
The floor of a number is the closest integer that is less than or equal to it.
A decimal number is almost never exact in memory : 8.2 * 100 holds 819.9999999999999, and a
naive floor( $value * $r ) / $r drops to 8.19. The scaled value is therefore rounded to six
decimals before the floor is taken : a scaled value within one millionth of an integer is
treated as sitting exactly on it, so only a real shortfall pushes the result down.
Parameters
- $value : int|float
-
The number to round.
- $floatCount : int = 0
-
The number of decimal places to round down to. A negative count is read as
0.
Tags
Return values
float —The rounded number.