This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

constants

Summary

Math constants return constant values that are properties of the Math object.

Syntax

Examples

The following example illustrates how to use the Math.PI constant.

var radius = 3;
 var area = Math.PI * radius * radius;
 document.write(area);

 // Output: 28.274333882308138

Math Object Constants

The following table lists constant values that are properties of the Math object.

ConstantDescriptionApproximate value
Math.EThe mathematical constant e. This is Euler’s number, the base of natural logarithms.2.718
Math.LN2The natural logarithm of 2.0.693
Math.LN10The natural logarithm of 10.2.302
Math.LOG2EThe base-2 logarithm of e.1.443
Math.LOG10EThe base-10 logarithm of e.0.434
Math.PIPi. This is the ratio of the circumference of a circle to its diameter.3.14159
Math.SQRT1_2The square root of 0.5, or, equivalently, one divided by the square root of 2.0.707
Math.SQRT2The square root of 2.1.414

See also

Other articles

Attributions

  • Microsoft Developer Network: Article