# Math

### min(values) <sub>function</sub>

Return the smallest of the zero or more given numbers. If no arguments are  provided, the result is Infinity. If any value is NaN, the result is NaN.



**values**: One or more numeric values.


**Returns**: The smallest numeric value, Infinity if no arguments, or NaN if any argument cannot be converted to a number.


### max(values) <sub>function</sub>

Return the largest of the zero or more given numbers. If no arguments are  provided, the result is -Infinity. If any value is NaN, the result is NaN.



**values**: One or more numeric values.


**Returns**: The largest numeric value, -Infinity if no arguments, or NaN if any argument cannot be converted to a number.


### abs(x) <sub>function</sub>

Return the absolute value of the given number. For example, -5 becomes 5.



**x**: A numeric value.


**Returns**: The absolute value of x.


### floor(x) <sub>function</sub>

Return the greatest integer less than or equal to x, effectively rounding down to the nearest integer.



**x**: A numeric value.


**Returns**: The largest integer <= x.


### ceil(x) <sub>function</sub>

Return the smallest integer greater than or equal to x, effectively rounding up to the nearest integer.



**x**: A numeric value.


**Returns**: The smallest integer >= x.


### round(x) <sub>function</sub>

Return x rounded to the nearest integer. If the fractional portion is 0.5 or
greater, rounds up; otherwise, rounds down. Ties away from zero in modern ECMAScript.



**x**: A numeric value.


**Returns**: x rounded to the nearest integer.


### sqrt(x) <sub>function</sub>

Return the positive square root of x. If x is negative, the result is NaN.



**x**: A non-negative numeric value.


**Returns**: The positive square root of x, or NaN if x is negative.


### acos(x) <sub>function</sub>

Return the arccosine (in radians) of x, in the range [0, π]. If x is outside
the range [-1, 1], the result is NaN.



**x**: A numeric value in [-1, 1].


**Returns**: The arccosine of x in radians, or NaN if out of range.


### asin(x) <sub>function</sub>

Return the arcsine (in radians) of x, in the range [-π/2, π/2]. If x is
outside [-1, 1], the result is NaN.



**x**: A numeric value in [-1, 1].


**Returns**: The arcsine of x in radians, or NaN if out of range.


### atan(x) <sub>function</sub>

Return the arctangent (in radians) of x, in the range [-π/2, π/2].



**x**: A numeric value.


**Returns**: The arctangent of x in radians.


### atan2(y, x) <sub>function</sub>

Return the arctangent of the quotient of its arguments (y / x), in the range
(-π, π]. This takes into account the signs of both x and y to determine
the correct quadrant.



**y**: The y coordinate.

**x**: The x coordinate.


**Returns**: The angle in radians between the positive x-axis and the point (x, y).


### cos(x) <sub>function</sub>

Return the cosine of x, where x is in radians.



**x**: A numeric value in radians.


**Returns**: The cosine of x, in the range [-1, 1].


### exp(x) <sub>function</sub>

Return e^x, where e is Euler's number (approximately 2.71828).



**x**: A numeric exponent.


**Returns**: The value of e raised to x.


### log(x) <sub>function</sub>

Return the natural logarithm (base e) of x. If x is <= 0, the result is NaN.



**x**: A positive numeric value.


**Returns**: The natural logarithm of x.


### pow(base, exponent) <sub>function</sub>

Return base raised to the power exponent, i.e. base^exponent. If base is
negative and exponent is not an integer, result is NaN.



**base**: The base number.

**exponent**: The exponent number.


**Returns**: base raised to exponent.


### sin(x) <sub>function</sub>

Return the sine of x, where x is in radians.



**x**: A numeric value in radians.


**Returns**: The sine of x, in the range [-1, 1].


### tan(x) <sub>function</sub>

Return the tangent of x, where x is in radians. If x is (π/2 + nπ), the
result is ±Infinity or NaN.



**x**: A numeric value in radians.


**Returns**: The tangent of x.


### trunc(x) <sub>function</sub>

Return the integer part of x by removing any fractional digits. Does not
round, just truncates.



**x**: A numeric value.


**Returns**: x truncated toward zero.


### sign(x) <sub>function</sub>

Return the sign of x, indicating whether x is positive, negative, or zero.
Returns 1 if x > 0, -1 if x < 0, 0 if x is 0, and NaN if x is NaN.



**x**: A numeric value.


**Returns**: 1, -1, 0, -0, or NaN, depending on x.


### cosh(x) <sub>function</sub>

Return the hyperbolic cosine of x, (e^x + e^-x) / 2.



**x**: A numeric value.


**Returns**: The hyperbolic cosine of x.


### sinh(x) <sub>function</sub>

Return the hyperbolic sine of x, (e^x - e^-x) / 2.



**x**: A numeric value.


**Returns**: The hyperbolic sine of x.


### tanh(x) <sub>function</sub>

Return the hyperbolic tangent of x, (e^x - e^-x) / (e^x + e^-x).



**x**: A numeric value.


**Returns**: The hyperbolic tangent of x.


### acosh(x) <sub>function</sub>

Return the inverse hyperbolic cosine of x, defined as ln(x + sqrt(x^2 - 1)).
If x < 1, the result is NaN.



**x**: A numeric value >= 1.


**Returns**: The inverse hyperbolic cosine of x.


### asinh(x) <sub>function</sub>

Return the inverse hyperbolic sine of x, defined as ln(x + sqrt(x^2 + 1)).



**x**: A numeric value.


**Returns**: The inverse hyperbolic sine of x.


### atanh(x) <sub>function</sub>

Return the inverse hyperbolic tangent of x, defined as 1/2 * ln((1 + x) / (1 - x)).
If |x| >= 1, the result is NaN.



**x**: A numeric value in the range (-1, 1).


**Returns**: The inverse hyperbolic tangent of x.


### expm1(x) <sub>function</sub>

Return e^x - 1, for small values of x this provides higher precision than
Math.exp(x) - 1.



**x**: A numeric exponent.


**Returns**: e^x - 1.


### log1p(x) <sub>function</sub>

Return the natural logarithm of (1 + x). More accurate than Math.log(1 + x)
for small x.



**x**: A numeric value > -1.


**Returns**: ln(1 + x).


### log2(x) <sub>function</sub>

Return the base-2 logarithm of x. If x <= 0, the result is NaN.



**x**: A positive numeric value.


**Returns**: The base-2 logarithm of x.


### log10(x) <sub>function</sub>

Return the base-10 logarithm of x. If x <= 0, the result is NaN.



**x**: A positive numeric value.


**Returns**: The base-10 logarithm of x.


### cbrt(x) <sub>function</sub>

Return the cube root of x, including negative values.



**x**: A numeric value (can be negative).


**Returns**: The cube root of x.


### hypot(values) <sub>function</sub>

Return the square root of the sum of squares of its arguments, i.e.
sqrt(x1^2 + x2^2 + ...). If any value is ±Infinity, returns Infinity. If
any value is NaN, returns NaN.



**values**: One or more numeric values.


**Returns**: The square root of the sum of squares of the arguments.


### random() <sub>function</sub>

Return a pseudo-random floating-point number in the range [0, 1).
The result is usually seeded by an engine-defined source of randomness.



**Returns**: A number >= 0 and < 1.


### fround(x) <sub>function</sub>

Return the nearest 32-bit single-precision float representation of x.



**x**: A numeric value.


**Returns**: The 32-bit float representation of x.


### imul(a, b) <sub>function</sub>

Return the result of a 32-bit integer multiplication of two values.
Effectively (a * b) | 0 in many implementations.



**a**: A numeric value.

**b**: A numeric value.


**Returns**: The 32-bit integer result of multiplying a by b.


### clz32(x) <sub>function</sub>

Return the number of leading zero bits in the 32-bit binary representation
of x. If x is 0, returns 32.



**x**: A numeric value, treated as a 32-bit unsigned integer.


**Returns**: The count of leading zero bits, in the range [0, 32].


### E <sub>number</sub>

### LN10 <sub>number</sub>

### LN2 <sub>number</sub>

### LOG2E <sub>number</sub>

### LOG10E <sub>number</sub>

### PI <sub>number</sub>

### SQRT1_2 <sub>number</sub>

### SQRT2 <sub>number</sub>
