Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Constans (constant), power functions (multiplication function), trigonometic functions (trigonometric function), rounding functions (rounding function), random numbers (random number)
Constants and multiplication functions
Math. E base (constant) of the natural logarithm 2.718
Math. LN10 10's natural logarithm of 2.302
Math. LN2 2's natural logarithm 0.693
Math. PI circumference rate 3.1415
Math. SQRT1_2 1/2 square root 0.707
Square root of Math. SQRT2 2 1.414
The square root of Math. sqrt (x) X is related to the value of X.
Math. pow (x, n) returns the n power of x. The numerical parameters are x and n.
Math. log (n) returns the natural logarithm of n as n.
Math. exp (n) returns the n power of e. The value parameter is n.
Cosine function of Math. cos (x) X
Sine function of Math. sin (x) X
Math. tan (x) X tangent function
Inverse cosine function of Math. acos (y) X
Math. asin (y) X inverse sine function
Arctangent function of Math. atan (y) X
Note: The unit of the return values of parameter x and inverse functions is radian (for example, PI radian = 180 degrees)
Rounding functions and random numbers
Math. random () generates a random number from 0 to 1
Math. round (x) returns the value closest to integer x.
Math. floor (x) is a value that is closest to integer x and smaller than x.
Math. ceil (x) is a value closest to integer x and greater than x.
Math. min (a, B, c) returns the smallest value in the parameter list.
Math. max (a, B, c) returns the maximum value in the parameter list.
Http://www.cnlei.org/blog/article.asp? Id = 408
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.