The mathematical function of JavaScript

Source: Internet
Author: User
Tags floor function natural logarithm square root

The JavaScript math function is actually the math object , which includes attributes and functions (or methods) in two parts. Among them, the property mainly has the following content:

   MATH.E: E (natural logarithm),math.ln2(natural logarithm of 2),math.ln10(natural logarithm of 10),math.log2e(logarithm of E, base 2), math.log10e (logarithm of E, base 10),Math.PI(π),math.sqrt1_2(square root value of 1/2),math.sqrt2(square root of 2).

The function has the following 18:

(1) ABS function: Math.Abs (the same as below), returns the absolute value of a number.

(2) ACOs function: Returns the inverse cosine of a number with a result of 0~π radians (radians).

(3) ASIN Function: Returns the inverse sine of a number, resulting in-Π/2~Π/2 radians.

(4) atan function: Returns the inverse tangent of a number with the result of-Π/2~Π/2 radians.

(5) atan2 function: Returns the polar coordinate angle value of a coordinate.

(6) ceil function: Returns the smallest integer value (greater than or equal to) of a number.

(7) cos function: Returns the cosine of a number with the result of -1~1.

(8) exp Function: Returns the value of the exponent of E (natural logarithm).

(9) Floor function: Returns the maximum integer value (less than or equal to) of a number.

(10) Log function: A natural logarithm function that returns the natural logarithm (e) value of a number.

(11) Max function: Returns the maximum value of two digits.

(12) min function: Returns the minimum value of two digits.

(13) POW function: Returns the value of a number.

(14) Random function: Returns a 0~1 value.

(15) round function: Returns the rounded value of a number with an integer type.

(16) sin function: Returns the sine of a number with the result of -1~1.

(17) sqrt function: Returns the square root value of a number.

(18) Tan function: Returns the tangent of a number.

The mathematical function of JavaScript

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.