PHP Класс 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.
Наследование: implements Neos\Eel\ProtectedContextAwareInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Описание методов

abs() публичный Метод

public abs ( float $x = 'NAN' ) : float
$x float A number
Результат float The absolute value of the given value

acos() публичный Метод

public acos ( float $x ) : float
$x float A number
Результат float The arccosine (in radians) of the given value

acosh() публичный Метод

public acosh ( float $x ) : float
$x float A number
Результат float The hyperbolic arccosine (in radians) of the given value

allowsCallOfMethod() публичный Метод

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
Результат boolean

asin() публичный Метод

public asin ( float $x ) : float
$x float A number
Результат float The arcsine (in radians) of the given value

asinh() публичный Метод

public asinh ( float $x ) : float
$x float A number
Результат float The hyperbolic arcsine (in radians) of the given value

atan() публичный Метод

public atan ( float $x ) : float
$x float A number
Результат float The arctangent (in radians) of the given value

atan2() публичный Метод

public atan2 ( float $y, float $x ) : float
$y float A number
$x float A number
Результат float The arctangent of the quotient of its arguments

atanh() публичный Метод

public atanh ( float $x ) : float
$x float A number
Результат float The hyperbolic arctangent (in radians) of the given value

cbrt() публичный Метод

public cbrt ( float $x ) : float
$x float A number
Результат float The cube root of the given value

ceil() публичный Метод

public ceil ( float $x ) : float
$x float A number
Результат float The smallest integer greater than or equal to the given value

cos() публичный Метод

public cos ( float $x ) : float
$x float A number given in radians
Результат float The cosine of the given value

cosh() публичный Метод

public cosh ( float $x ) : float
$x float A number
Результат float The hyperbolic cosine of the given value

exp() публичный Метод

public exp ( float $x ) : float
$x float A number
Результат float The power of the Euler's constant with the given value (e^x)

expm1() публичный Метод

public expm1 ( float $x ) : float
$x float A number
Результат float The power of the Euler's constant with the given value minus 1 (e^x - 1)

floor() публичный Метод

public floor ( float $x ) : float
$x float A number
Результат float The largest integer less than or equal to the given value

getE() публичный Метод

public getE ( ) : float
Результат float Euler's constant and the base of natural logarithms, approximately 2.718

getLN10() публичный Метод

public getLN10 ( ) : float
Результат float Natural logarithm of 10, approximately 2.303

getLN2() публичный Метод

public getLN2 ( ) : float
Результат float Natural logarithm of 2, approximately 0.693

getLOG10E() публичный Метод

public getLOG10E ( ) : float
Результат float Base 10 logarithm of E, approximately 0.434

getLOG2E() публичный Метод

public getLOG2E ( ) : float
Результат float Base 2 logarithm of E, approximately 1.443

getPI() публичный Метод

public getPI ( ) : float
Результат float Ratio of the circumference of a circle to its diameter, approximately 3.14159

getSQRT1_2() публичный Метод

public getSQRT1_2 ( ) : float
Результат float Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707

getSQRT2() публичный Метод

public getSQRT2 ( ) : float
Результат float Square root of 2, approximately 1.414

hypot() публичный Метод

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
Результат float The square root of the sum of squares of the arguments

isFinite() публичный Метод

This is equivalent to the global isFinite() function in JavaScript.
public isFinite ( mixed $x ) : boolean
$x mixed A value
Результат boolean TRUE if the value is a finite (not NAN) number

isInfinite() публичный Метод

This function has no direct equivalent in JavaScript.
public isInfinite ( mixed $x ) : boolean
$x mixed A value
Результат boolean TRUE if the value is INF or -INF

isNaN() публичный Метод

This is equivalent to the global isNaN() function in JavaScript.
public isNaN ( mixed $x ) : boolean
$x mixed A value
Результат boolean TRUE if the value is not a number

log() публичный Метод

public log ( float $x ) : float
$x float A number
Результат float The natural logarithm (base e) of the given value

log10() публичный Метод

public log10 ( float $x ) : float
$x float A number
Результат float The base 10 logarithm of the given value

log1p() публичный Метод

public log1p ( float $x ) : float
$x float A number
Результат float The natural logarithm (base e) of 1 + the given value

log2() публичный Метод

public log2 ( float $x ) : float
$x float A number
Результат float The base 2 logarithm of the given value

max() публичный Метод

public max ( float $x = null, float $y_ = null ) : float
$x float A number
$y_ float Optional variable list of additional numbers
Результат float The largest of the given numbers (zero or more)

min() публичный Метод

public min ( float $x = null, float $y_ = null ) : float
$x float A number
$y_ float Optional variable list of additional numbers
Результат float The smallest of the given numbers (zero or more)

pow() публичный Метод

Calculate the power of x by y
public pow ( float $x, float $y ) : float
$x float The base
$y float The exponent
Результат float The base to the exponent power (x^y)

random() публичный Метод

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
Результат float A random floating point number between 0 (inclusive) and 1 (exclusive), that is from [0, 1)

randomInt() публичный Метод

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)
Результат integer A random number between min and max (inclusive), that is from [min, max]

round() публичный Метод

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
Результат float The rounded value

sign() публичный Метод

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
Результат integer -1, 0, 1 depending on the sign or NAN if the given value was not numeric

sin() публичный Метод

public sin ( float $x ) : float
$x float A number given in radians
Результат float The sine of the given value

sinh() публичный Метод

public sinh ( float $x ) : float
$x float A number
Результат float The hyperbolic sine of the given value

sqrt() публичный Метод

public sqrt ( float $x ) : float
$x float A number
Результат float The square root of the given number

tan() публичный Метод

public tan ( float $x ) : float
$x float A number given in radians
Результат float The tangent of the given value

tanh() публичный Метод

public tanh ( float $x ) : float
$x float A number
Результат float The hyperbolic tangent of the given value

trunc() публичный Метод

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
Результат integer The integral part of the given number