20 public static function round($number, $precision)
26 return $e->getMessage();
29 return round($number, (
int) $precision);
42 public static function up($number, $digits)
48 return $e->getMessage();
56 return round($number - 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_DOWN);
59 return round($number + 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_DOWN);
72 public static function down($number, $digits)
78 return $e->getMessage();
86 return round($number + 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_UP);
89 return round($number - 0.5 * 0.1 ** $digits, $digits, PHP_ROUND_HALF_UP);
102 public static function multiple($number, $multiple)
108 return $e->getMessage();
111 if ($number == 0 || $multiple == 0) {
115 $multiplier = 1 / $multiple;
117 return round($number * $multiplier) / $multiplier;
139 public static function even($number)
144 return $e->getMessage();
159 public static function odd($number)
164 return $e->getMessage();
168 if ($significance == 0) {
172 $result = ceil($number / $significance) * $significance;
static validateNumericNullBool($number)
Many functions accept null/false/true argument treated as 0/0/1.
static up($number, $digits)
ROUNDUP.
static getEven(float $number)
static validateNumericNullSubstitution($number, $substitute)
Validate numeric, but allow substitute for null.
static multiple($number, $multiple)
MROUND.
static even($number)
EVEN.
static down($number, $digits)
ROUNDDOWN.
static returnSign(float $number)
static round($number, $precision)
ROUND.