# A set of mathematical functions in JavaScript basics

Source: Internet
Author: User
In JavaScript, mathematical methods can be grouped into the following categories:
Constans (constant), power functions (exponentiation function), trigonometic functions (trigonometric function), rounding functions (rounding functions), random numbers (random number)

Reference
Constants and exponentiation functions

MATH.E of the natural logarithm (for constant) 2.718
Natural logarithm of math.ln10 10 2.302
Natural logarithm of MATH.LN2 2 0.693
Math.PI Pi 3.1415
Math.sqrt1_2 1/2 Square root 0.707
Math.sqrt2 2 square root 1.414
MATH.SQRT (x) x has a value for the square root more X
Math.pow (x, N) returns the N-second square of x with a numeric parameter of x and N
Math.log (n) returns the natural logarithm parameter n of n
MATH.EXP (n) returns the N-second side of E with a numeric parameter of n

Trigonometric function

cosine function of Math.Cos (x) x
sine function of Math.sin (x) x
Tangent function of Math.tan (x) x
Inverse cosine function of Math.acos (y) x
Math.asin (y) x's inverse chord function
Inverse tangent function of Math.atan (y) 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)

Rounding functions and random numbers

Math.random () generates random numbers from 0 to 1
Math.Round (x) takes the nearest integer x value
Math.floor (x) takes the nearest integer x and the number smaller than X
Math.ceil (x) takes the nearest integer x and is larger than X
Math.min (A, B, c) returns the smallest number in the argument list
Math.max (A, B, c) returns the largest number in the argument list

Original: http://www.cnlei.org/blog/article.asp?id=408
Related Keywords:
Related Article

## E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

## Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

## Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth \$300-1200 USD