Helpers
in package
Table of Contents
Methods
- getEven() : float
- numberOrNan() : float|string
- Return NAN or value depending on argument.
- returnSign() : int
- validateNotNegative() : void
- Confirm number >= 0.
- validateNotZero() : void
- Confirm number != 0.
- validateNumericNullBool() : int|float
- Many functions accept null/false/true argument treated as 0/0/1.
- validateNumericNullSubstitution() : float|int
- Validate numeric, but allow substitute for null.
- validatePositive() : void
- Confirm number > 0.
- verySmallDenominator() : float|string
- Many functions accept null/false/true argument treated as 0/0/1.
Methods
getEven()
public
static getEven(float $number) : float
Parameters
- $number : float
Return values
floatnumberOrNan()
Return NAN or value depending on argument.
public
static numberOrNan(float $result) : float|string
Parameters
- $result : float
Return values
float|stringreturnSign()
public
static returnSign(float $number) : int
Parameters
- $number : float
Return values
intvalidateNotNegative()
Confirm number >= 0.
public
static validateNotNegative(float|int $number[, string|null $except = null ]) : void
Parameters
- $number : float|int
- $except : string|null = null
validateNotZero()
Confirm number != 0.
public
static validateNotZero(float|int $number) : void
Parameters
- $number : float|int
validateNumericNullBool()
Many functions accept null/false/true argument treated as 0/0/1.
public
static validateNumericNullBool(mixed $number) : int|float
Parameters
- $number : mixed
Return values
int|floatvalidateNumericNullSubstitution()
Validate numeric, but allow substitute for null.
public
static validateNumericNullSubstitution(mixed $number, null|float|int $substitute) : float|int
Parameters
- $number : mixed
- $substitute : null|float|int
Return values
float|intvalidatePositive()
Confirm number > 0.
public
static validatePositive(float|int $number[, string|null $except = null ]) : void
Parameters
- $number : float|int
- $except : string|null = null
verySmallDenominator()
Many functions accept null/false/true argument treated as 0/0/1.
public
static verySmallDenominator(float $numerator, float $denominator) : float|string
Parameters
- $numerator : float
- $denominator : float
Return values
float|string —quotient or DIV0 if denominator is too small