Math constants

There are several constants used in JavaScript which we can use in our calculation. Let us see how to calculate the perimeter of a circle of radius 2 meter.
document.write ( " Perimeter of a circle of diameter 2 meter = " + Math.PI*2 + " meter ");
Output of this is here
Perimeter of a circle of diameter 2 meter = 6.283185307179586 meter
There are few more constants and here is the list.
Constants Description
Math.PIValue is 3.141592653589793. This is the value of PI used trigonometry
Math.EValue is 2.718281828459045, known as Euler's constant
Math.LN2Equal to 0.6931471805599453, natural logarithm of 2
Math.LN10Equal to 2.302585092994046 natural logarithm of 10
Math.LOG2E Equal to 1.4426950408889633 base 2 logarithm of E
Math.LOG10EEqual to 0.4342944819032518 base 10 logarithm of E
Math.SQRT2Equal to 1.4142135623730951 square root of 2
Math.SQRT1_2 Equal to 0.7071067811865476 square root of 1/2

JavaScript Math Reference


* indicates required
Subscribe to plus2net

    Post your comments , suggestion , error , requirements etc here

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 All rights reserved worldwide Privacy Policy Disclaimer