Math

@native @JSType trait Math extends StObject
trait StObject
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

def abs(x: Double): Double

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.

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.

Value Params
x

A numeric expression for which the absolute value is needed.

def acos(x: Double): Double

Returns the arc cosine (or inverse cosine) of a number.

Returns the arc cosine (or inverse cosine) of a number.

Value Params
x

A numeric expression.

def acosh(x: Double): Double

Returns the inverse hyperbolic cosine of a number.

Returns the inverse hyperbolic cosine of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def asin(x: Double): Double

Returns the arcsine of a number.

Returns the arcsine of a number.

Value Params
x

A numeric expression.

def asinh(x: Double): Double

Returns the inverse hyperbolic sine of a number.

Returns the inverse hyperbolic sine of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def atan(x: Double): Double

Returns the arctangent of a number.

Returns the arctangent of a number.

Value Params
x

A numeric expression for which the arctangent is needed.

def atan2(y: Double, x: Double): Double

Returns the angle (in radians) from the X axis to a point.

Returns the angle (in radians) from the X axis to a point.

Value Params
x

A numeric expression representing the cartesian x-coordinate.

y

A numeric expression representing the cartesian y-coordinate.

def atanh(x: Double): Double

Returns the inverse hyperbolic tangent of a number.

Returns the inverse hyperbolic tangent of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def cbrt(x: Double): Double

Returns an implementation-dependent approximation to the cube root of number.

Returns an implementation-dependent approximation to the cube root of number.

Value Params
x

A numeric expression.

def ceil(x: Double): Double

Returns the smallest integer greater than or equal to its numeric argument.

Returns the smallest integer greater than or equal to its numeric argument.

Value Params
x

A numeric expression.

def clz32(x: Double): Double

Returns the number of leading zero bits in the 32-bit binary representation of a number.

Returns the number of leading zero bits in the 32-bit binary representation of a number.

Value Params
x

A numeric expression.

def cos(x: Double): Double

Returns the cosine of a number.

Returns the cosine of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def cosh(x: Double): Double

Returns the hyperbolic cosine of a number.

Returns the hyperbolic cosine of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def exp(x: Double): Double

Returns e (the base of natural logarithms) raised to a power.

Returns e (the base of natural logarithms) raised to a power.

Value Params
x

A numeric expression representing the power of e.

def expm1(x: Double): Double

Returns the result of (e^x - 1), which is an implementation-dependent approximation to subtracting 1 from the exponential function of x (e raised to the power of x, where e is the base of the natural logarithms).

Returns the result of (e^x - 1), which is an implementation-dependent approximation to subtracting 1 from the exponential function of x (e raised to the power of x, where e is the base of the natural logarithms).

Value Params
x

A numeric expression.

def floor(x: Double): Double

Returns the greatest integer less than or equal to its numeric argument.

Returns the greatest integer less than or equal to its numeric argument.

Value Params
x

A numeric expression.

def fround(x: Double): Double

Returns the nearest single precision float representation of a number.

Returns the nearest single precision float representation of a number.

Value Params
x

A numeric expression.

def hypot(values: Double*): Double

Returns the square root of the sum of squares of its arguments.

Returns the square root of the sum of squares of its arguments.

Value Params
values

Values to compute the square root for. If no arguments are passed, the result is +0. If there is only one argument, the result is the absolute value. If any argument is +Infinity or -Infinity, the result is +Infinity. If any argument is NaN, the result is NaN. If all arguments are either +0 or −0, the result is +0.

def imul(x: Double, y: Double): Double

Returns the result of 32-bit multiplication of two numbers.

Returns the result of 32-bit multiplication of two numbers.

Value Params
x

First number

y

Second number

def log(x: Double): Double

Returns the natural logarithm (base e) of a number.

Returns the natural logarithm (base e) of a number.

Value Params
x

A numeric expression.

def log10(x: Double): Double

Returns the base 10 logarithm of a number.

Returns the base 10 logarithm of a number.

Value Params
x

A numeric expression.

def log1p(x: Double): Double

Returns the natural logarithm of 1 + x.

Returns the natural logarithm of 1 + x.

Value Params
x

A numeric expression.

def log2(x: Double): Double

Returns the base 2 logarithm of a number.

Returns the base 2 logarithm of a number.

Value Params
x

A numeric expression.

def max(values: Double*): Double

Returns the larger of a set of supplied numeric expressions.

Returns the larger of a set of supplied numeric expressions.

Value Params
values

Numeric expressions to be evaluated.

def min(values: Double*): Double

Returns the smaller of a set of supplied numeric expressions.

Returns the smaller of a set of supplied numeric expressions.

Value Params
values

Numeric expressions to be evaluated.

def pow(x: Double, y: Double): Double

Returns the value of a base expression taken to a specified power.

Returns the value of a base expression taken to a specified power.

Value Params
x

The base value of the expression.

y

The exponent value of the expression.

def random(): Double

Returns a pseudorandom number between 0 and 1.

Returns a pseudorandom number between 0 and 1.

def round(x: Double): Double

Returns a supplied numeric expression rounded to the nearest integer.

Returns a supplied numeric expression rounded to the nearest integer.

Value Params
x

The value to be rounded to the nearest integer.

def sign(x: Double): Double

Returns the sign of the x, indicating whether x is positive, negative or zero.

Returns the sign of the x, indicating whether x is positive, negative or zero.

Value Params
x

The numeric expression to test

def sin(x: Double): Double

Returns the sine of a number.

Returns the sine of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def sinh(x: Double): Double

Returns the hyperbolic sine of a number.

Returns the hyperbolic sine of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def sqrt(x: Double): Double

Returns the square root of a number.

Returns the square root of a number.

Value Params
x

A numeric expression.

def tan(x: Double): Double

Returns the tangent of a number.

Returns the tangent of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def tanh(x: Double): Double

Returns the hyperbolic tangent of a number.

Returns the hyperbolic tangent of a number.

Value Params
x

A numeric expression that contains an angle measured in radians.

def trunc(x: Double): Double

Returns the integral part of the a numeric expression, x, removing any fractional digits. If x is already an integer, the result is x.

Returns the integral part of the a numeric expression, x, removing any fractional digits. If x is already an integer, the result is x.

Value Params
x

A numeric expression.

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from
Object
def isPrototypeOf(v: Object): Boolean
Inherited from
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from
Object
def toLocaleString(): String
Inherited from
Object
def valueOf(): Any
Inherited from
Object

Concrete fields

val E: Double

The mathematical constant e. This is Euler's number, the base of natural logarithms.

The mathematical constant e. This is Euler's number, the base of natural logarithms.

val LN10: Double

The natural logarithm of 10.

The natural logarithm of 10.

val LN2: Double

The natural logarithm of 2.

The natural logarithm of 2.

val LOG10E: Double

The base-10 logarithm of e.

The base-10 logarithm of e.

val LOG2E: Double

The base-2 logarithm of e.

The base-2 logarithm of e.

val PI: Double

Pi. This is the ratio of the circumference of a circle to its diameter.

Pi. This is the ratio of the circumference of a circle to its diameter.

val SQRT1_2: Double

The square root of 0.5, or, equivalently, one divided by the square root of 2.

The square root of 0.5, or, equivalently, one divided by the square root of 2.

val SQRT2: Double

The square root of 2.

The square root of 2.

@JSName
val toStringTag: String