26 public static function ceiling($number, $significance = null)
28 if ($significance === null) {
29 self::floorCheck1Arg();
36 return $e->getMessage();
39 return self::argumentsOk((
float) $number, (
float) $significance);
56 public static function math($number, $significance = null, $mode = 0)
63 return $e->getMessage();
66 if (empty($significance * $number)) {
69 if (self::ceilingMathTest((
float) $significance, (
float) $number, (
int) $mode)) {
70 return floor($number / $significance) * $significance;
73 return ceil($number / $significance) * $significance;
89 public static function precise($number, $significance = 1)
95 return $e->getMessage();
101 $result = $number / abs($significance);
103 return ceil(
$result) * $significance * (($significance < 0) ? -1 : 1);
109 private static function ceilingMathTest(
float $significance,
float $number,
int $mode): bool
111 return ((
float) $significance < 0) || ((float) $number < 0 && !empty($mode));
119 private static function argumentsOk(
float $number,
float $significance)
121 if (empty($number * $significance)) {
125 return ceil($number / $significance) * $significance;
135 throw new Exception(
'Excel requires 2 arguments for CEILING');
static ceiling($number, $significance=null)
CEILING.
static validateNumericNullBool($number)
Many functions accept null/false/true argument treated as 0/0/1.
static math($number, $significance=null, $mode=0)
CEILING.MATH.
static ceilingMathTest(float $significance, float $number, int $mode)
Let CEILINGMATH complexity pass Scrutinizer.
static precise($number, $significance=1)
CEILING.PRECISE.
static validateNumericNullSubstitution($number, $substitute)
Validate numeric, but allow substitute for null.
const COMPATIBILITY_EXCEL
constants
static argumentsOk(float $number, float $significance)
Avoid Scrutinizer problems concerning complexity.
static returnSign(float $number)
static getCompatibilityMode()
Return the current Compatibility Mode.