mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 07:51:52 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<p><code><strong>Math.log()</strong></code> 函数返回一个数的自然对数,即:</p>
|
||||
<p><math><semantics><mrow><mo>∀</mo><mi>x</mi><mo>></mo><mn>0</mn><mo>,</mo><mstyle mathvariant="monospace"><mrow><mo lspace="0em" rspace="thinmathspace">Math.log</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo></mrow></mstyle><mo>=</mo><mo lspace="0em" rspace="0em">ln</mo><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mtext>the unique</mtext><mspace width="thickmathspace"></mspace><mi>y</mi><mspace width="thickmathspace"></mspace><mtext>such that</mtext><mspace width="thickmathspace"></mspace><msup><mi>e</mi><mi>y</mi></msup><mo>=</mo><mi>x</mi></mrow><annotation encoding="TeX">\forall x > 0, \mathtt{\operatorname{Math.log}(x)} = \ln(x) = \text{the unique} \; y \; \text{such that} \; e^y = x</annotation></semantics></math></p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code>Math.log(<em>x</em>)</code></pre>
|
||||
<pre><code class="language-javascript"><code>Math.log(<em>x</em>)</code></code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<dl>
|
||||
<dt><code>x</code></dt>
|
||||
@@ -16,15 +16,15 @@
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="Example:_Using_Math.log" name="Example:_Using_Math.log">例子1:使用<code>Math.log</code></h3>
|
||||
<p>下面的函数返回指定变量的自然对数:</p>
|
||||
<pre class="brush:js">Math.log(-1); // NaN, out of range
|
||||
<pre><code class="language-js">Math.log(-1); // NaN, out of range
|
||||
Math.log(0); // -Infinity
|
||||
Math.log(1); // 0
|
||||
Math.log(10); // 2.302585092994046</pre>
|
||||
Math.log(10); // 2.302585092994046</code></pre>
|
||||
<h3 id="例子2_使用Math.log时基于不同的底数">例子2: 使用<code>Math.log</code>时基于不同的底数</h3>
|
||||
<p>下面的函数返回以 <code>x</code> 为底 <code>y</code> 的对数(即log<sub>x</sub> y):</p>
|
||||
<pre class="brush:js">function getBaseLog(x, y) {
|
||||
<pre><code class="language-js">function getBaseLog(x, y) {
|
||||
return Math.log(y) / Math.log(x);
|
||||
}</pre>
|
||||
}</code></pre>
|
||||
<p>如果你运行 <code>getBaseLog(10, 1000),则会返回</code><code>2.9999999999999996,非常接近实际答案:3,原因是浮点数精度问题。</code></p>
|
||||
<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2>
|
||||
<table class="standard-table">
|
||||
|
||||
Reference in New Issue
Block a user