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