Math.cosh() 函数返回数值的双曲余弦函数,可用 Math.E 表示:
<math display="block"><semantics><mrow><mstyle mathvariant="monospace"><mo lspace="0em" rspace="thinmathspace">Math.cosh(x)</mo></mstyle><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><mn>2</mn></mfrac></mrow><annotation encoding="TeX">\mathtt{\operatorname{Math.cosh(x)}} = \frac{e^x + e^{-x}}{2}</annotation></semantics></math>
语法
Math.cosh(x)
参数
x- : 数值。
描述
由于 cosh() 是 Math 的静态函数,只需通过 Math.cosh() 调用,而不用通过创建 Math 对象来调用。
示例
使用 Math.cosh()
Math.cosh(0); // 1
Math.cosh(1); // 1.5430806348152437
Math.cosh(-1); // 1.5430806348152437
规范
浏览器兼容性
参见
core-js中Math.cosh的 polyfill- Math.acosh()
- Math.asinh()
- Math.atanh()
- Math.sinh()
- Math.tanh()
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
