Module js_sys::Math[][src]

Functions

abs

The Math.abs() function returns the absolute value of a number, that is Math.abs(x) = |x|

acos

The Math.acos() function returns the arccosine (in radians) of a number, that is ∀x∊[-1;1] Math.acos(x) = arccos(x) = the unique y∊[0;π] such that cos(y)=x

acosh

The Math.acosh() function returns the hyperbolic arc-cosine of a number, that is ∀x ≥ 1 Math.acosh(x) = arcosh(x) = the unique y ≥ 0 such that cosh(y) = x

asin

The Math.asin() function returns the arcsine (in radians) of a number, that is ∀x ∊ [-1;1] Math.asin(x) = arcsin(x) = the unique y∊[-π2;π2] such that sin(y) = x

asinh

The Math.asinh() function returns the hyperbolic arcsine of a number, that is Math.asinh(x) = arsinh(x) = the unique y such that sinh(y) = x

atan

The Math.atan() function returns the arctangent (in radians) of a number, that is Math.atan(x) = arctan(x) = the unique y ∊ [-π2;π2]such that tan(y) = x

atan2

The Math.atan2() function returns the arctangent of the quotient of its arguments.

atanh

The Math.atanh() function returns the hyperbolic arctangent of a number, that is ∀x ∊ (-1,1), Math.atanh(x) = arctanh(x) = the unique y such that tanh(y) = x

cbrt

The Math.cbrt() function returns the cube root of a number, that is Math.cbrt(x) = ∛x = the unique y such that y^3 = x

ceil

The Math.ceil() function returns the smallest integer greater than or equal to a given number.

clz32

The Math.clz32() function returns the number of leading zero bits in the 32-bit binary representation of a number.

cos

The Math.cos() static function returns the cosine of the specified angle, which must be specified in radians. This value is length(adjacent)/length(hypotenuse).

cosh

The Math.cosh() function returns the hyperbolic cosine of a number, that can be expressed using the constant e.

exp

The Math.exp() function returns e^x, where x is the argument, and e is Euler’s number (also known as Napier’s constant), the base of the natural logarithms.

expm1

The Math.expm1() function returns e^x - 1, where x is the argument, and e the base of the natural logarithms.

floor

The Math.floor() function returns the largest integer less than or equal to a given number.

fround

The Math.fround() function returns the nearest 32-bit single precision float representation of a Number.

hypot

The Math.hypot() function returns the square root of the sum of squares of its arguments.

imul

The Math.imul() function returns the result of the C-like 32-bit multiplication of the two parameters.

log

The Math.log() function returns the natural logarithm (base e) of a number. The JavaScript Math.log() function is equivalent to ln(x) in mathematics.

log1p

The Math.log1p() function returns the natural logarithm (base e) of 1 + a number. MDN documentation

log2

The Math.log2() function returns the base 2 logarithm of a number.

log10

The Math.log10() function returns the base 10 logarithm of a number.

max

The Math.max() function returns the largest of two numbers.

min

The static function Math.min() returns the lowest-valued number passed into it.

pow

The Math.pow() function returns the base to the exponent power, that is, base^exponent.

random

The Math.random() function returns a floating-point, pseudo-random number in the range 0–1 (inclusive of 0, but not 1) with approximately uniform distribution over that range — which you can then scale to your desired range. The implementation selects the initial seed to the random number generation algorithm; it cannot be chosen or reset by the user.

round

The Math.round() function returns the value of a number rounded to the nearest integer.

sign

The Math.sign() function returns the sign of a number, indicating whether the number is positive, negative or zero.

sin

The Math.sin() function returns the sine of a number.

sinh

The Math.sinh() function returns the hyperbolic sine of a number, that can be expressed using the constant e: Math.sinh(x) = (e^x - e^-x)/2

sqrt

The Math.sqrt() function returns the square root of a number, that is ∀x ≥ 0, Math.sqrt(x) = √x = the unique y ≥ 0 such that y^2 = x

tan

The Math.tan() function returns the tangent of a number.

tanh

The Math.tanh() function returns the hyperbolic tangent of a number, that is tanh x = sinh x / cosh x = (e^x - e^-x)/(e^x + e^-x) = (e^2x - 1)/(e^2x + 1)

trunc

The Math.trunc() function returns the integer part of a number by removing any fractional digits.