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