Methods of Math objects in js

Source: Internet
Author: User
Tags acos asin natural logarithm

1. discard the fractional part and keep the integer part parseInt (5/2) 2. rounded up. If there is a decimal number, add 1Math to the integer. ceil (5/2) 3, rounded down. math. round (5/2) 4, round down Math. floor (5/2) Math object method FF: Firefox, N: Netscape, IE: Internet Explorer method description ff n ie abs (x) returns the absolute value of the number 1 2 3 acos (x) returns the arccosine of the number 1 2 3 asin (x) returns the arcsin of the number 1 2 3 atan (x) returns the arc tangent value of x between-PI/2 and PI/2 radian. The value is 1 2 3 atan2 (y, x) and returns the value from the x-axis to the point (x, y) angle (between-PI/2 and PI/2 radian) 1 2 3 ceil (x) to round up a number. 1 2 3 cos (x) returns the cosine of the number 1 2 3 exp (x) returns the e index. 1 2 3 floor (x) switches a number down. 1 2 3 log (x) returns the natural logarithm of the number (Base e) 1 2 3 max (x, y) returns the highest values in x and y 1 2 3 min (x, y) returns the lowest value of 1 2 3 pow (x, y) In x and y, returns the power of y x, which is 1 2 3 random (), and returns 0 ~ Random number between 1 1 2 3 round (x) rounds a number into the nearest integer 1 2 3 sin (x) returns the sine of the number 1 2 3 sqrt (x) returns the square root of a number 1 2 3 tan (x) returns the tangent of an angle 1 2 3 toSource () representing the source code of the object 1 4-valueOf () returns the original value of a Math object. math. abs (num): returns the absolute value of num 2. math. acos (num): returns the arc cosine of num 3. math. asin (num): returns the arcsin value of num 4. math. atan (num): returns the arc tangent value of num 5. math. atan2 (y, x): returns the arc tangent value of the quotient dividing y by x 6. math. ceil (num): returns the smallest integer greater than num 7. math. cos (num): returns the cosine of num 8. math. exp (x): returns the number 9 of x power based on the natural number. math. floor (num): returns the maximum integer 10 less than num. math. log (num): returns the natural logarithm of num 11. math. max (num1, num2): returns a large value of 12 in num1 and num2. math. min (num1, num2): return a smaller 13 in num1 and num2. math. pow (x, y): returns the value 14 to the power of y of x. math. random (): returns a random number between 0 and 1. math. round (num): return the value 16 after num rounding. math. sin (num): returns the sine of num 17. math. sqrt (num): returns the square root of num 18. math. tan (num): returns the tangent of num 19. math. e: Natural Number (2.718281828459045) 20. math. LN2: natural logarithm of 2 (0.6931471805599453) 21. math. LN10: 10 natural logarithm (2.302585092994046) 22. math. LOG2E: log 2 is the base natural number (1.4426950408889634) 23. math. LOG10E: The base Natural Number of log 10 (0.4342944819032518) 24. math. PI: π (3.141592653589793) 25. math. SQRT1_2: the square root of 1/2 (0.7071067811865476) 26. math. SQRT2: square root of 2 (1.4142135623730951)

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.