Name
Math
Synopsis
Math.constantMath.function( )
Description
The Math object is a placeholder for grouping mathematical constants
and functions. It does not define a class of objects as Date and
String do. There is no Math( ) constructor, and
functions like Math.sin( ) are simply functions,
not methods that operate on an object.
Constants
-
Math.E The constant e, the base of the natural logarithm.
-
Math.LN10 The natural logarithm of 10.
-
Math.LN2 The natural logarithm of 2.
-
Math.LOG10E The base-10 logarithm of e.
-
Math.LOG2E The base-2 logarithm of e.
-
Math.PI The constant π.
-
Math.SQRT1_2 1 divided by the square root of 2.
-
Math.SQRT2 The square root of 2.
Functions
-
Math.abs(x) Returns the absolute value of
x.-
Math.acos(x) Returns the arc cosine of
x; the return value is between 0 and π radians.-
Math.asin(x) Returns the arc sine of
x; the return value is between -π/2 and π/2 radians.-
Math.atan(x) Returns the arc tangent of
x; the return value is between -π/2 and π/2 radians.-
Math.atan2(y,x) Returns a value between -π and π radians that specifies the counterclockwise angle between the positive X-axis and the point (
x,y). Note the order of the arguments to this function.-
Math.ceil(x) Returns the nearest integer greater than or equal to
x.-
Math.cos(x) Returns the cosine of the specified value
x.-
Math.exp(x) Returns the constant e raised to the power of
x.-
Math.floor(x) Returns the nearest integer less than or equal to
x.-
Math.log(x) Returns the natural logarithm ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access