Math
in package
An intrinsic object that provides basic mathematics functionality and constants.
Table of Contents
Constants
- E = 2.718281828459045
- The mathematical constant e. This is Euler's number, the base of natural logarithms.
- LN10 = 2.302585092994046
- The natural logarithm of 10.
- LN2 = 0.6931471805599453
- The natural logarithm of 2.
- LOG10E = 0.4342944819032518
- The base-10 logarithm of e.
- LOG2E = 1.4426950408889634
- The base-2 logarithm of e.
- PI = 3.141592653589793
- Pi. This is the ratio of the circumference of a circle to its diameter.
- SQRT1_2 = 0.7071067811865476
- The square root of 0.5, or, equivalently, one divided by the square root of 2.
- SQRT2 = 1.4142135623730951
- The square root of 2.
Methods
- abs() : int|float
- Returns the absolute value of a number (the value without regard to whether it is positive or negative). For example, the absolute value of -5 is the same as the absolute value of 5.
- acos() : float
- Returns the arc cosine (or inverse cosine) of a number.
- __construct() : mixed
Constants
E
The mathematical constant e. This is Euler's number, the base of natural logarithms.
public
mixed
E
= 2.718281828459045
LN10
The natural logarithm of 10.
public
mixed
LN10
= 2.302585092994046
LN2
The natural logarithm of 2.
public
mixed
LN2
= 0.6931471805599453
LOG10E
The base-10 logarithm of e.
public
mixed
LOG10E
= 0.4342944819032518
LOG2E
The base-2 logarithm of e.
public
mixed
LOG2E
= 1.4426950408889634
PI
Pi. This is the ratio of the circumference of a circle to its diameter.
public
mixed
PI
= 3.141592653589793
SQRT1_2
The square root of 0.5, or, equivalently, one divided by the square root of 2.
public
mixed
SQRT1_2
= 0.7071067811865476
SQRT2
The square root of 2.
public
mixed
SQRT2
= 1.4142135623730951
Methods
abs()
Returns the absolute value of a number (the value without regard to whether it is positive or negative). For example, the absolute value of -5 is the same as the absolute value of 5.
public
static abs(int|float $number) : int|float
Parameters
- $number : int|float
-
A numeric expression for which the absolute value is needed.
Return values
int|floatacos()
Returns the arc cosine (or inverse cosine) of a number.
public
static acos(int|float $number) : float
Parameters
- $number : int|float
-
A numeric expression.
Return values
float__construct()
protected
__construct() : mixed