# Math

### Related Doc: package js

#### object Math extends Object

Math is a built-in object that has properties and methods for mathematical constants and functions. Not a function object.

MDN

Annotations
() ()
Linear Supertypes
Ordering
1. Alphabetic
2. By Inheritance
Inherited
1. Math
2. Object
3. Any
4. AnyRef
5. Any
1. Hide All
2. Show All
Visibility
1. Public
2. All

### Value Members

1. #### final def !=(arg0: scala.Any): Boolean

Definition Classes
AnyRef → Any
2. #### final def ##(): Int

Definition Classes
AnyRef → Any
3. #### final def ==(arg0: scala.Any): Boolean

Definition Classes
AnyRef → Any
4. #### val E: Double

Euler's constant and the base of natural logarithms, approximately 2.718.

Euler's constant and the base of natural logarithms, approximately 2.718.

MDN

5. #### val LN10: Double

Natural logarithm of 10, approximately 2.303.

Natural logarithm of 10, approximately 2.303.

MDN

6. #### val LN2: Double

Natural logarithm of 2, approximately 0.693.

Natural logarithm of 2, approximately 0.693.

MDN

7. #### val LOG10E: Double

Base 10 logarithm of E, approximately 0.434.

Base 10 logarithm of E, approximately 0.434.

MSN

8. #### val LOG2E: Double

Base 2 logarithm of E, approximately 1.443.

Base 2 logarithm of E, approximately 1.443.

MDN

9. #### val PI: Double

Ratio of the circumference of a circle to its diameter, approximately 3.14159.

Ratio of the circumference of a circle to its diameter, approximately 3.14159.

MDN

10. #### val SQRT1_2: Double

Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.

Square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707.

MDN

11. #### val SQRT2: Double

Square root of 2, approximately 1.414.

Square root of 2, approximately 1.414.

MDN

12. #### def abs(x: Double): Double

Returns the absolute value of a number.

Returns the absolute value of a number.

Passing a non-numeric string or undefined/empty variable returns NaN. Passing null returns 0.

MDN

13. #### def abs(x: Int): Int

Returns the absolute value of a number.

Returns the absolute value of a number.

Passing a non-numeric string or undefined/empty variable returns NaN. Passing null returns 0.

MDN

14. #### def acos(x: Double): Double

The Math.acos() function returns the arccosine (in radians) of a number.

The Math.acos() function returns the arccosine (in radians) of a number.

The acos method returns a numeric value between 0 and pi radians for x between -1 and 1. If the value of number is outside this range, it returns NaN.

MDN

15. #### final def asInstanceOf[T0]: T0

Definition Classes
Any
16. #### def asin(x: Double): Double

The Math.asin() function returns the arcsine (in radians) of a number.

The Math.asin() function returns the arcsine (in radians) of a number.

The asin method returns a numeric value between -pi/2 and pi/2 radians for x between -1 and 1. If the value of number is outside this range, it returns NaN.

MDN

17. #### def atan(x: Double): Double

The Math.atan() function returns the arctangent (in radians) of a number.

The Math.atan() function returns the arctangent (in radians) of a number.

The atan method returns a numeric value between -pi/2 and pi/2 radians.

MDN

18. #### def atan2(y: Double, x: Double): Double

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

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

The atan2 method returns a numeric value between -pi and pi representing the angle theta of an (x,y) point. This is the counterclockwise angle, measured in radians, between the positive X axis, and the point (x,y). Note that the arguments to this function pass the y-coordinate first and the x-coordinate second.

atan2 is passed separate x and y arguments, and atan is passed the ratio of those two arguments.

MDN

19. #### def cbrt(x: Double): Double

ECMAScript 6 The Math.cbrt() function returns the cube root of a number

ECMAScript 6 The Math.cbrt() function returns the cube root of a number

returns

The cube root of the given number. MDN

20. #### def ceil(x: Double): Double

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

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

MDN

21. #### def clone(): AnyRef

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( ... )
22. #### def cos(x: Double): Double

The Math.cos() function returns the cosine of a number.

The Math.cos() function returns the cosine of a number.

The cos method returns a numeric value between -1 and 1, which represents the cosine of the angle.

MDN

23. #### def cosh(x: Double): Double

ECMAScript 6 The Math.cosh() function returns the hyperbolic cosine of a number

ECMAScript 6 The Math.cosh() function returns the hyperbolic cosine of a number

returns

The hyperbolic cosine of the given number MDN

24. #### final def eq(arg0: AnyRef): Boolean

Definition Classes
AnyRef
25. #### def equals(arg0: scala.Any): Boolean

Definition Classes
AnyRef → Any
26. #### def exp(x: Double): Double

The Math.exp() function returns E^x, where x is the argument, and E is Euler's constant, the base of the natural logarithms.

The Math.exp() function returns E^x, where x is the argument, and E is Euler's constant, the base of the natural logarithms.

MDN

27. #### def expm1(x: Double): Double

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

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

returns

A number representing e^x - 1, where e is Euler's number and x is the argument.

28. #### def finalize(): Unit

Attributes
protected[java.lang]
Definition Classes
AnyRef
Annotations
@throws( classOf[java.lang.Throwable] )
29. #### def floor(x: Double): Double

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

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

MDN

30. #### final def getClass(): Class[_]

Definition Classes
AnyRef → Any
31. #### def hasOwnProperty(v: String): Boolean

Tests whether this object has the specified property as a direct property.

Tests whether this object has the specified property as a direct property.

Unlike js.Object.hasProperty, this method does not check down the object's prototype chain.

MDN

Definition Classes
Object
32. #### def hashCode(): Int

Definition Classes
AnyRef → Any
33. #### def hypot(x: Double*): Double

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

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

returns

The square root of the sum of squares of the given arguments. MDN

34. #### final def isInstanceOf[T0]: Boolean

Definition Classes
Any
35. #### def isPrototypeOf(v: Object): Boolean

Tests whether this object is in the prototype chain of another object.

Tests whether this object is in the prototype chain of another object.

Definition Classes
Object
36. #### def log(x: Double): Double

The Math.log() function returns the natural logarithm (base E) of a number.

The Math.log() function returns the natural logarithm (base E) of a number.

If the value of number is negative, the return value is always NaN.

MDN

37. #### def log10(x: Double): Double

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

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

returns

The base 10 logarithm of the given number. If the number is negative, NaN is returned. MDN

38. #### def log1p(x: Double): Double

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

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

returns

The natural logarithm (base e) of 1 plus the given number. If the number is less than -1, NaN is returned. MDN

39. #### def max(values: Double*): Double

The Math.max() function returns the largest of zero or more numbers.

The Math.max() function returns the largest of zero or more numbers.

If no arguments are given, the result is - Infinity.

If at least one of arguments cannot be converted to a number, the result is NaN.

MDN

40. #### def max(value1: Int, values: Int*): Int

The Math.max() function returns the largest of zero or more numbers.

The Math.max() function returns the largest of zero or more numbers.

MDN

41. #### def min(values: Double*): Double

The Math.min() function returns the smallest of zero or more numbers.

The Math.min() function returns the smallest of zero or more numbers.

If no arguments are given, the result is Infinity.

If at least one of arguments cannot be converted to a number, the result is NaN.

MDN

42. #### def min(value1: Int, values: Int*): Int

The Math.min() function returns the smallest of zero or more numbers.

The Math.min() function returns the smallest of zero or more numbers.

MDN

43. #### final def ne(arg0: AnyRef): Boolean

Definition Classes
AnyRef
44. #### final def notify(): Unit

Definition Classes
AnyRef
45. #### final def notifyAll(): Unit

Definition Classes
AnyRef
46. #### def pow(x: Double, y: Double): Double

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

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

MDN

47. #### def propertyIsEnumerable(v: String): Boolean

Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain.

Tests whether the specified property in an object can be enumerated by a call to js.Object.properties, with the exception of properties inherited through the prototype chain. If the object does not have the specified property, this method returns false.

MDN

Definition Classes
Object
48. #### def random(): Double

The Math.random() function returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range.

The Math.random() function returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range.

The random number generator is seeded from the current time, as in Java.

MDN

49. #### def round(x: Double): Double

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

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

If the fractional portion of number is .5 or greater, the argument is rounded to the next higher integer. If the fractional portion of number is less than .5, the argument is rounded to the next lower integer.

MDN

50. #### def sin(x: Double): Double

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

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

The sin method returns a numeric value between -1 and 1, which represents the sine of the angle given in radians.

MDN

51. #### def sinh(x: Double): Double

ECMAScript 6 The Math.sinh() function returns the hyperbolic sine of a number

ECMAScript 6 The Math.sinh() function returns the hyperbolic sine of a number

returns

The hyperbolic sine of the given number MDN

52. #### def sqrt(x: Double): Double

The Math.sqrt() function returns the square root (x\sqrt{x}) of a number.

The Math.sqrt() function returns the square root (x\sqrt{x}) of a number.

If the value of number is negative, sqrt returns NaN.

MDN

53. #### final def synchronized[T0](arg0: ⇒ T0): T0

Definition Classes
AnyRef
54. #### def tan(x: Double): Double

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

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

The tan method returns a numeric value that represents the tangent of the angle.

MDN

55. #### def tanh(x: Double): Double

ECMAScript 6 The Math.tanh() function returns the hyperbolic tangent of a number

ECMAScript 6 The Math.tanh() function returns the hyperbolic tangent of a number

returns

The hyperbolic tangent of the given number MDN

56. #### def toLocaleString(): String

Definition Classes
Object
57. #### def toString(): String

Definition Classes
AnyRef → Any
58. #### def valueOf(): scala.Any

Definition Classes
Object
59. #### final def wait(): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
60. #### final def wait(arg0: Long, arg1: Int): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )
61. #### final def wait(arg0: Long): Unit

Definition Classes
AnyRef
Annotations
@throws( ... )