MathHelper
class MathHelper implements ProtectedContextAwareInterface (View source)
Math helpers for Eel contexts
The implementation sticks to the JavaScript specificiation including EcmaScript 6 proposals.
See https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Math for a documentation and specification of the JavaScript implementation.
Methods
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Test if the given value is a finite number
Test if the given value is an infinite number (INF or -INF)
Test if the given value is not a number (either not numeric or NAN)
No description
No description
No description
No description
No description
No description
No description
Calculate the power of x by y
Get a random foating point number between 0 (inclusive) and 1 (exclusive)
Get a random integer number between a min and max value (inclusive)
Rounds the subject to the given precision
Get the sign of the given number, indicating whether the number is positive, negative or zero
No description
No description
No description
No description
No description
Get the integral part of the given number by removing any fractional digits
All methods are considered safe
Details
float
getE()
No description
float
getLN2()
No description
float
getLN10()
No description
float
getLOG2E()
No description
float
getLOG10E()
No description
float
getPI()
No description
float
getSQRT1_2()
No description
float
getSQRT2()
No description
float
abs(float $x = 'NAN')
No description
float
acos(float $x)
No description
float
acosh(float $x)
No description
float
asin(float $x)
No description
float
asinh(float $x)
No description
float
atan(float $x)
No description
float
atanh(float $x)
No description
float
atan2(float $y, float $x)
No description
float
cbrt(float $x)
No description
float
ceil(float $x)
No description
float
cos(float $x)
No description
float
cosh(float $x)
No description
float
exp(float $x)
No description
float
expm1(float $x)
No description
float
floor(float $x)
No description
bool
isFinite(mixed $x)
Test if the given value is a finite number
This is equivalent to the global isFinite() function in JavaScript.
bool
isInfinite(mixed $x)
Test if the given value is an infinite number (INF or -INF)
This function has no direct equivalent in JavaScript.
bool
isNaN(mixed $x)
Test if the given value is not a number (either not numeric or NAN)
This is equivalent to the global isNaN() function in JavaScript.
float
hypot(float $x, float $y, float $z_ = null)
No description
float
log(float $x)
No description
float
log1p(float $x)
No description
float
log10(float $x)
No description
float
log2(float $x)
No description
float
max(float $x = null, float $y_ = null)
No description
float
min(float $x = null, float $y_ = null)
No description
float
pow(float $x, float $y)
Calculate the power of x by y
float
random()
Get a random foating point number between 0 (inclusive) and 1 (exclusive)
That means a result will always be less than 1 and greater or equal to 0, the same way Math.random() works in JavaScript.
See Math.randomInt(min, max) for a function that returns random integer numbers from a given interval.
int
randomInt(int $min, int $max)
Get a random integer number between a min and max value (inclusive)
That means a result will always be greater than or equal to min and less than or equal to max.
float
round(mixed $subject, int $precision = 0)
Rounds the subject to the given precision
The precision defines the number of digits after the decimal point. Negative values are also supported (-1 rounds to full 10ths).
int
sign(int|float $x)
Get the sign of the given number, indicating whether the number is positive, negative or zero
float
sin(float $x)
No description
float
sinh(float $x)
No description
float
sqrt(float $x)
No description
float
tan(float $x)
No description
float
tanh(float $x)
No description
int
trunc(float $x)
Get the integral part of the given number by removing any fractional digits
This function doesn't round the given number but merely calls ceil(x) or floor(x) depending on the sign of the number.
bool
allowsCallOfMethod(string $methodName)
All methods are considered safe