Skip to content

Latest commit

 

History

History
79 lines (70 loc) · 2.72 KB

File metadata and controls

79 lines (70 loc) · 2.72 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
Math Constants (JavaScript) | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
JavaScript
TypeScript
DHTML
LN2 constant [JavaScript]
E constant [JavaScript]
LOG10E constant [JavaScript]
SQRT1_2 constant [JavaScript]
LOG2E constant [JavaScript]
Math.SQRT2 constant [JavaScript]
PI constant [JavaScript]
Math.LOG2E constant [JavaScript]
constants [JavaScript], math
Math.E constant [JavaScript]
logarithm consants [JavaScript]
Math.LOG10E constant [JavaScript]
Math.SQRT1_2 constant [JavaScript]
SQRT2 constant [JavaScript]
square root constants [JavaScript]
Math.PI constant [JavaScript]
math constants [JavaScript]
LN10 constant [JavaScript]
Math.LN2 constant [JavaScript]
Math.LN10 constant [JavaScript]
8a674046-cb99-4103-92be-83697fba6344
13
mikejo5000
mikejo
ghogen

Math Constants (JavaScript)

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

Math Object Constants

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

Constant Description Approximate value
Math.E The mathematical constant e. This is Euler's number, the base of natural logarithms. 2.718
Math.LN2 The natural logarithm of 2. 0.693
Math.LN10 The natural logarithm of 10. 2.302
Math.LOG2E The base-2 logarithm of e. 1.443
Math.LOG10E The base-10 logarithm of e. 0.434
Math.PI Pi. This is the ratio of the circumference of a circle to its diameter. 3.14159
Math.SQRT1_2 The square root of 0.5, or, equivalently, one divided by the square root of 2. 0.707
Math.SQRT2 The square root of 2. 1.414

Example

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  
  

Requirements

[!INCLUDEjsv1]

Applies To: Math Object

See Also

Number Constants
JavaScript Constants