Attributes of the math object

Source: Internet
Author: User
Tags natural logarithm

The methods under the math object must be very familiar to everyone, but the attributes of the math object are rarely used. These attributes are some common mathematical result sets, it can be understood as a group of constants, although this concept is not found in the current JavaScript.

Attribute Approximate value Description
Math. e 2.718 Constant E
Math. ln2 0.693 Natural logarithm of 2
Math. ln10 2.302 Natural logarithm of 10
Math. log2e 1.442 Base-2 logarithm of E
Math. log10e 0.434 Base-10 logarithm of E
Math. Pi 3.14159 Constant π
Math. sqrt1_2 0.707 Square root of 0.5
Math. sqrt2 1.414 Square root of 2

Knowing and even remembering them, maybe they will be used at any time. Calling them is much more efficient than creating a method.
It is worth noting that the above values are all about values, and there is a slight difference in the precision obtained in different browsers, which needs to be controlled during use.

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.