Math object (Object/core)

A globally available object containing a library of mathematical functions.


ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise Server version - 2.0
Opera - 3.0
JavaScript syntax:-Math
Object properties:constructor
Class constants:E, LN10, LN2, LOG10E, LOG2E, PI, SQRT1_2, SQRT2
Functions:abs(), acos(), asin(), atan(), atan2(), ceil(), cos(), exp(), floor(), log(), max(), min(), pow(), random(), round(), sin(), sqrt(), tan()

The Math object is merely a single object owned by the Global Object and which cannot be instantiated. It has some named properties, some of which are functions while others are constants.

The prototype for the Math prototype object is the Object prototype object.

Although it cannot be instantiated, it does have a constructor which in turn has a prototype property. By adding functions to that prototype, you can extend the capabilities of the Math object. Several examples are provided in nearby topics to illustrate the addition of extra trigonometric and hyperbolic functions.


Math.sin(Math.PI/2) may not yield exactly 1

Math.cos(Math.PI) may not return precisely zero

Math.acos(0) may not return the same value as Math.PI

Math.SQRT1_2 may not be exactly equal to the reciprocal of Math.SQRT2

See also:Constant, Exponent-log function, Global object, Integer arithmetic, Java to JavaScript values, Native object, Object constant, Object object, Range error, Trigonometric function, Type conversion, unwatch(), watch()

constructor1.0 1.01.0 1.02.0 2.03.02 3.02 n/a n/a n/a n/a n/a n/a-


ECMA 262 edition 2 - section - 10.1.5

ECMA 262 edition 2 - section -

ECMA 262 edition 2 - section - 15.8

ECMA 262 edition 3 - section - 10.1.5

ECMA 262 edition 3 - section -

ECMA 262 edition 3 - section - 15.8