Get the App
SLTechnology News&Howtos  ›  Development  › 

How does JavaScript find the logarithm

Shulou Source: shulou.com Published: 2022-06-02 11:22:13 10月01日 Update

This article mainly explains "how to find logarithms in JavaScript". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "JavaScript how to find the logarithm"!

Find the logarithm method: 1, the use of LN2 attribute, syntax "Math.LN2", can return 2 natural logarithm; 2, the use of LN10 attribute, syntax "Math.LN10"; 3, the use of LOG2E attribute, syntax "Math.LOG2E"; 4, the use of log () method, syntax "Math.log (x)".

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

JavaScript's method of finding logarithms:

1. Make use of the LN2 property of Math object

The LN2 property is

Can return the natural logarithm of 2 (about 0.693), whose value is similar to 0.69314718055994528623.

Syntax: Math.LN2

2. Use the LN10 property of the Math object

The LN10 property is

The natural logarithm of 10 can be returned (about 2.302), with a value similar to 2.3025850929940459011.

Syntax: Math.LN10

3. Use the LOG2E property of Math object

The LOG2E property is log2e, which returns the logarithm of e with a base of 2 (about 1.4426950408889634).

Syntax: Math.LOG2E

4. Use the LOG10E property of the Math object

The LOG10E property is that returns the logarithm of e with a base of 10 (about 0.434).

Syntax: Math.LOG10E

5. Using the log () method of Math object

The log () method returns the natural logarithm of a number (based on E).

Syntax: Math.log (x)

X: required. Any numeric value or expression.

Returns NaN if x is negative.

If x is 0, return-Infinity.

Example:

Math.log (2)

Can output:

0.6931471805599453 here, I believe you have a deeper understanding of "JavaScript how to find the logarithm", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Logarithm attribute grammar method object that is natural content learning practical deeper number interest practicality practical simple operation tutorials numerical values more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info vpn Xiaomi NVidia