Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does JavaScript find the logarithm

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report