1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Math Method Reference

Related Resources


The Math object holds useful methods and constants to use in mathematical calculations. These methods and constants can be substituted in your javascript wherever numerical values are allowed. The Math object is pre-defined so does not need to be defined before use. The methods available with the Math object are:

  • Math.abs(number) absolute value
  • Math.acos(number) arc cosine (in radians)
  • Math.asin(number) arc sine (in radians)
  • Math.atan(number) arc tangent (in radians)
  • Math.cos(num_radians) cosine
  • Math.sin(num_radians) sine
  • Math.tan(num_radians) tangent
  • Math.ceil(number) smallest integer >= number
  • Math.floor(number) largest integer <= number
  • Math.exp(number) e to the power of number
  • Math.log(number) natural log of number
  • Math.pow(base,exponent) base to exponent power
  • Math.max(number,number) greater of the two numbers
  • Math.min(number,number) smaller of the two numbers
  • Math.round(number) rounds the number to the nearest integer
  • Math.sqrt(number) finds the square root of the number

The Math object also defines a number of useful constants (approximate values indicated).

  • Math.PI pi (3.14159...)
  • Math.E e (2.718...)
  • Math.LN2 natural log of 2 (0.693...)
  • Math.LN10() natural log of 10 (2.302...)
  • Math.LOG10E() base 10 log of e (0.434...)
  • Math.SQRT1_2() square root of 1/2 (0.707...)
  • Math.SQRT2 square root of 2 (1.414...)
See More About
Explore JavaScript
By Category
    javascriptJavaScriptcomputeTechb950eefb2a063b7b4e00399d305537ef3a00038e0c006b2ahttp://javascript.about.comod526F6F7412274terminatedStephen Chapmanjavascriptguide3Og00025zNIP11970-01-0110/od/index.htm0526F6F741approved/od
  1. About.com
  2. Tech
  3. JavaScript

©2015 About.com. All rights reserved.