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
Datei anzeigen Open project: neos/flow-development-collection Class Usage Examples

Public Methods

Method 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 method

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

acos() public method

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

acosh() public method

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

allowsCallOfMethod() public method

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
return boolean

asin() public method

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

asinh() public method

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

atan() public method

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

atan2() public method

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

atanh() public method

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

cbrt() public method

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

ceil() public method

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

cos() public method

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

cosh() public method

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

exp() public method

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

expm1() public method

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

floor() public method

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

getE() public method

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

getLN10() public method

public getLN10 ( ) : float
return float Natural logarithm of 10, approximately 2.303

getLN2() public method

public getLN2 ( ) : float
return float Natural logarithm of 2, approximately 0.693

getLOG10E() public method

public getLOG10E ( ) : float
return float Base 10 logarithm of E, approximately 0.434

getLOG2E() public method

public getLOG2E ( ) : float
return float Base 2 logarithm of E, approximately 1.443

getPI() public method

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

getSQRT1_2() public method

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

getSQRT2() public method

public getSQRT2 ( ) : float
return float Square root of 2, approximately 1.414

hypot() public method

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
return float The square root of the sum of squares of the arguments

isFinite() public method

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

isInfinite() public method

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

isNaN() public method

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

log() public method

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

log10() public method

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

log1p() public method

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

log2() public method

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

max() public method

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

min() public method

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

pow() public method

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

random() public method

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
return float A random floating point number between 0 (inclusive) and 1 (exclusive), that is from [0, 1)

randomInt() public method

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)
return integer A random number between min and max (inclusive), that is from [min, max]

round() public method

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
return float The rounded value

sign() public method

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
return integer -1, 0, 1 depending on the sign or NAN if the given value was not numeric

sin() public method

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

sinh() public method

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

sqrt() public method

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

tan() public method

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

tanh() public method

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

trunc() public method

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
return integer The integral part of the given number