PHP Class Neos\Eel\Helper\MathHelper

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.
Inheritance: implements Neos\Eel\ProtectedContextAwareInterface
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Méthodes publiques

Méthode Description
abs ( float $x = 'NAN' ) : float
acos ( float $x ) : float
acosh ( float $x ) : float
allowsCallOfMethod ( string $methodName ) : boolean All methods are considered safe
asin ( float $x ) : float
asinh ( float $x ) : float
atan ( float $x ) : float
atan2 ( float $y, float $x ) : float
atanh ( float $x ) : float
cbrt ( float $x ) : float
ceil ( float $x ) : float
cos ( float $x ) : float
cosh ( float $x ) : float
exp ( float $x ) : float
expm1 ( float $x ) : float
floor ( float $x ) : float
getE ( ) : float
getLN10 ( ) : float
getLN2 ( ) : float
getLOG10E ( ) : float
getLOG2E ( ) : float
getPI ( ) : float
getSQRT1_2 ( ) : float
getSQRT2 ( ) : float
hypot ( float $x, float $y, float $z_ = null ) : float
isFinite ( mixed $x ) : boolean Test if the given value is a finite number
isInfinite ( mixed $x ) : boolean Test if the given value is an infinite number (INF or -INF)
isNaN ( mixed $x ) : boolean Test if the given value is not a number (either not numeric or NAN)
log ( float $x ) : float
log10 ( float $x ) : float
log1p ( float $x ) : float
log2 ( float $x ) : float
max ( float $x = null, float $y_ = null ) : float
min ( float $x = null, float $y_ = null ) : float
pow ( float $x, float $y ) : float Calculate the power of x by y
random ( ) : float Get a random foating point number between 0 (inclusive) and 1 (exclusive)
randomInt ( integer $min, integer $max ) : integer Get a random integer number between a min and max value (inclusive)
round ( float $subject, integer $precision ) : float Rounds the subject to the given precision
sign ( integer | float $x ) : integer Get the sign of the given number, indicating whether the number is positive, negative or zero
sin ( float $x ) : float
sinh ( float $x ) : float
sqrt ( float $x ) : float
tan ( float $x ) : float
tanh ( float $x ) : float
trunc ( float $x ) : integer Get the integral part of the given number by removing any fractional digits

Method Details

abs() public méthode

public abs ( float $x = 'NAN' ) : float
$x float A number
Résultat float The absolute value of the given value

acos() public méthode

public acos ( float $x ) : float
$x float A number
Résultat float The arccosine (in radians) of the given value

acosh() public méthode

public acosh ( float $x ) : float
$x float A number
Résultat float The hyperbolic arccosine (in radians) of the given value

allowsCallOfMethod() public méthode

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
Résultat boolean

asin() public méthode

public asin ( float $x ) : float
$x float A number
Résultat float The arcsine (in radians) of the given value

asinh() public méthode

public asinh ( float $x ) : float
$x float A number
Résultat float The hyperbolic arcsine (in radians) of the given value

atan() public méthode

public atan ( float $x ) : float
$x float A number
Résultat float The arctangent (in radians) of the given value

atan2() public méthode

public atan2 ( float $y, float $x ) : float
$y float A number
$x float A number
Résultat float The arctangent of the quotient of its arguments

atanh() public méthode

public atanh ( float $x ) : float
$x float A number
Résultat float The hyperbolic arctangent (in radians) of the given value

cbrt() public méthode

public cbrt ( float $x ) : float
$x float A number
Résultat float The cube root of the given value

ceil() public méthode

public ceil ( float $x ) : float
$x float A number
Résultat float The smallest integer greater than or equal to the given value

cos() public méthode

public cos ( float $x ) : float
$x float A number given in radians
Résultat float The cosine of the given value

cosh() public méthode

public cosh ( float $x ) : float
$x float A number
Résultat float The hyperbolic cosine of the given value

exp() public méthode

public exp ( float $x ) : float
$x float A number
Résultat float The power of the Euler's constant with the given value (e^x)

expm1() public méthode

public expm1 ( float $x ) : float
$x float A number
Résultat float The power of the Euler's constant with the given value minus 1 (e^x - 1)

floor() public méthode

public floor ( float $x ) : float
$x float A number
Résultat float The largest integer less than or equal to the given value

getE() public méthode

public getE ( ) : float
Résultat float Euler's constant and the base of natural logarithms, approximately 2.718

getLN10() public méthode

public getLN10 ( ) : float
Résultat float Natural logarithm of 10, approximately 2.303

getLN2() public méthode

public getLN2 ( ) : float
Résultat float Natural logarithm of 2, approximately 0.693

getLOG10E() public méthode

public getLOG10E ( ) : float
Résultat float Base 10 logarithm of E, approximately 0.434

getLOG2E() public méthode

public getLOG2E ( ) : float
Résultat float Base 2 logarithm of E, approximately 1.443

getPI() public méthode

public getPI ( ) : float
Résultat float Ratio of the circumference of a circle to its diameter, approximately 3.14159

getSQRT1_2() public méthode

public getSQRT1_2 ( ) : float
Résultat float Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707

getSQRT2() public méthode

public getSQRT2 ( ) : float
Résultat float Square root of 2, approximately 1.414

hypot() public méthode

public hypot ( float $x, float $y, float $z_ = null ) : float
$x float A number
$y float A number
$z_ float Optional variable list of additional numbers
Résultat float The square root of the sum of squares of the arguments

isFinite() public méthode

This is equivalent to the global isFinite() function in JavaScript.
public isFinite ( mixed $x ) : boolean
$x mixed A value
Résultat boolean TRUE if the value is a finite (not NAN) number

isInfinite() public méthode

This function has no direct equivalent in JavaScript.
public isInfinite ( mixed $x ) : boolean
$x mixed A value
Résultat boolean TRUE if the value is INF or -INF

isNaN() public méthode

This is equivalent to the global isNaN() function in JavaScript.
public isNaN ( mixed $x ) : boolean
$x mixed A value
Résultat boolean TRUE if the value is not a number

log() public méthode

public log ( float $x ) : float
$x float A number
Résultat float The natural logarithm (base e) of the given value

log10() public méthode

public log10 ( float $x ) : float
$x float A number
Résultat float The base 10 logarithm of the given value

log1p() public méthode

public log1p ( float $x ) : float
$x float A number
Résultat float The natural logarithm (base e) of 1 + the given value

log2() public méthode

public log2 ( float $x ) : float
$x float A number
Résultat float The base 2 logarithm of the given value

max() public méthode

public max ( float $x = null, float $y_ = null ) : float
$x float A number
$y_ float Optional variable list of additional numbers
Résultat float The largest of the given numbers (zero or more)

min() public méthode

public min ( float $x = null, float $y_ = null ) : float
$x float A number
$y_ float Optional variable list of additional numbers
Résultat float The smallest of the given numbers (zero or more)

pow() public méthode

Calculate the power of x by y
public pow ( float $x, float $y ) : float
$x float The base
$y float The exponent
Résultat float The base to the exponent power (x^y)

random() public méthode

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.
public random ( ) : float
Résultat float A random floating point number between 0 (inclusive) and 1 (exclusive), that is from [0, 1)

randomInt() public méthode

That means a result will always be greater than or equal to min and less than or equal to max.
public randomInt ( integer $min, integer $max ) : integer
$min integer The lower bound for the random number (inclusive)
$max integer The upper bound for the random number (inclusive)
Résultat integer A random number between min and max (inclusive), that is from [min, max]

round() public méthode

The precision defines the number of digits after the decimal point. Negative values are also supported (-1 rounds to full 10ths).
public round ( float $subject, integer $precision ) : float
$subject float The value to round
$precision integer The precision (digits after decimal point) to use, defaults to 0
Résultat float The rounded value

sign() public méthode

Get the sign of the given number, indicating whether the number is positive, negative or zero
public sign ( integer | float $x ) : integer
$x integer | float The value
Résultat integer -1, 0, 1 depending on the sign or NAN if the given value was not numeric

sin() public méthode

public sin ( float $x ) : float
$x float A number given in radians
Résultat float The sine of the given value

sinh() public méthode

public sinh ( float $x ) : float
$x float A number
Résultat float The hyperbolic sine of the given value

sqrt() public méthode

public sqrt ( float $x ) : float
$x float A number
Résultat float The square root of the given number

tan() public méthode

public tan ( float $x ) : float
$x float A number given in radians
Résultat float The tangent of the given value

tanh() public méthode

public tanh ( float $x ) : float
$x float A number
Résultat float The hyperbolic tangent of the given value

trunc() public méthode

This function doesn't round the given number but merely calls ceil(x) or floor(x) depending on the sign of the number.
public trunc ( float $x ) : integer
$x float A number
Résultat integer The integral part of the given number