语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -3,7 +3,7 @@
<p><strong><code>Math.tanh()</code></strong> 函数将会返回一个数的双曲正切函数值,计算如下:</p>
<p><math display="block"><semantics><mrow><mo lspace="0em" rspace="0em">tanh</mo><mi>x</mi><mo>=</mo><mfrac><mrow><mo lspace="0em" rspace="0em">sinh</mo><mi>x</mi></mrow><mrow><mo lspace="0em" rspace="0em">cosh</mo><mi>x</mi></mrow></mfrac><mo>=</mo><mfrac><mrow><msup><mi>e</mi><mi>x</mi></msup><mo>-</mo><msup><mi>e</mi><mrow><mo>-</mo><mi>x</mi></mrow></msup></mrow><mrow><msup><mi>e</mi><mi>x</mi></msup><mo>+</mo><msup><mi>e</mi><mrow><mo>-</mo><mi>x</mi></mrow></msup></mrow></mfrac><mo>=</mo><mfrac><mrow><msup><mi>e</mi><mrow><mn>2</mn><mi>x</mi></mrow></msup><mo>-</mo><mn>1</mn></mrow><mrow><msup><mi>e</mi><mrow><mn>2</mn><mi>x</mi></mrow></msup><mo>+</mo><mn>1</mn></mrow></mfrac></mrow><annotation encoding="TeX">\tanh x = \frac{\sinh x}{\cosh x} = \frac {e^x - e^{-x}} {e^x + e^{-x}} = \frac{e^{2x} - 1}{e^{2x}+1}</annotation></semantics></math></p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox"><code>Math.tanh(<var>x</var>)</code></pre>
<pre><code class="language-javascript"><code>Math.tanh(<var>x</var>)</code></code></pre>
<h3 id="参数">?参数</h3>
<dl>
<dt><code>x</code></dt>
@@ -15,13 +15,13 @@
<p><code>因为tanh()是Math的一个静态方法, 所以应该直接通过Math.tanh()来使用,而不是由用户先创建出Math对象再调用该方法。(Math不是一个构造器)。</code></p>
<h2 id="示例">示例</h2>
<h3 id="使用_Math.tanh()">使用 <code>Math.tanh()</code></h3>
<pre class="brush: js">Math.tanh(0); // 0
<pre><code class="language-javascript">Math.tanh(0); // 0
Math.tanh(Infinity); // 1
Math.tanh(1); // 0.7615941559557649
</pre>
</code></pre>
<h2 id="多种实现方式">多种实现方式</h2>
<p>tanh()可以通过<a href="Reference/Global_Objects/Math/exp" title="Math.exp() 函数返回 exx 表示参数e 是欧拉常数Euler's constant自然对数的底数。"><code>Math.exp()</code></a>函数来构拟:</p>
<pre class="brush: js">Math.tanh = Math.tanh || function(x) {
<pre><code class="language-javascript">Math.tanh = Math.tanh || function(x) {
if (x === Infinity) {
return 1;
} else if (x === -Infinity) {
@@ -30,9 +30,9 @@ Math.tanh(1); // 0.7615941559557649
return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));
}
}
</pre>
</code></pre>
<p>或者只调用一次<a href="Reference/Global_Objects/Math/exp" title="Math.exp() 函数返回 exx 表示参数e 是欧拉常数Euler's constant自然对数的底数。"><code>Math.exp()</code></a>:</p>
<pre class="brush: js">Math.tanh = Math.tanh || function(x) {
<pre><code class="language-javascript">Math.tanh = Math.tanh || function(x) {
if (x === Infinity) {
return 1;
} else if (x === -Infinity) {
@@ -42,7 +42,7 @@ Math.tanh(1); // 0.7615941559557649
return (y - 1) / (y + 1);
}
}
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>