Math functions that use JavaScript

Source: Internet
Author: User
Tags constant functions natural logarithm square root
Javascript| functions in JavaScript, mathematical methods can be grouped into the following categories: Constans(constant), Power Functions(exponentiation function), trigonometic Functions(Trigonometric functions), Rounding Functions(Rounding function) and Random Numbers(random numbers). The following are described individually:

Constants and exponentiation functions

MATH.E
The bottom of the natural logarithm (for constant)
2.718

Math.ln10
10 of the natural logarithm
2.302

MATH.LN2
2 of the natural logarithm
0.693

Math.PI
Pi
3.1415

Math.sqrt1_2
Square root of 1/2
0.707

Math.sqrt2
Square root of 2
1.414

MATH.SQRT (x)
Square root of X
The value of the more X is related

Math.pow (x, N)
Returns the value of the N-second side of X
Parameters are X and n

Math.log (n)
Returns the natural logarithm of n
Parameter is n

math.exp (n)
Returns the value of the N-second side of E
Parameter is n


Trigonometric function

Math.Cos (x)
cosine function of X

Math.sin (x)
The sine function of X

Math.tan (x)
The tangent function of X

Math.acos (y)
Inverse cosine function of x

math.asin (y)
The inverse chord function of X

Math.atan (y)
The inverse tangent function of x


Note here: Both the parameter X and the units of the returned values of the inverse function are radians (for example, pi radians = 180 degrees)



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.