The math Object [2|3|I]

The math object provides properties and methods for advanced mathematical calculations.

Properties

  • E— The value of Euler's constant (roughly 2.718) used as the base for natural logarithms.

  • LN10— The value of the natural logarithm of 10 (roughly 2.302).

  • LN2— The value of the natural logarithm of 2 (roughly 0.693).

  • LOG10E— The value of the base-10 logarithm of e (roughly 0.434).

  • LOG2E— The value of the base 2 logarithm of e (roughly 1.442).

  • PI— The value of π used to calculate the circumference and area of circles (roughly 3.1415).

  • SQRT1_2— The value of the square root of one-half (roughly 0.707).

  • SQRT2— The value of the square root of two (roughly 1.414).

Methods

  • abs(number)— Returns the absolute value of number. The absolute

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.