| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/es/docs/Web/JavaScript/Reference/Global_Objects/Math/tanh | [Back] [Original] |
Get to know MDN better
Esta pgina ha sido traducida del ingls por la comunidad. Aprende ms y nete a la comunidad de MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its been available across browsers since julio de 2015.
La funcion Math.tanh() devuelve la hyperbolica tangente de un numero, esto es
console.log(Math.tanh(-1));
// Expected output: -0.7615941559557649
console.log(Math.tanh(0));
// Expected output: 0
console.log(Math.tanh(Infinity));
// Expected output: 1
console.log(Math.tanh(1));
// Expected output: 0.7615941559557649
Math.tanh(x)
xUn numero.
La hyperbolica tangente del numero obtenido.
Porque tanh() es un metodo estatico de Math, siempre se usa como Math.tanh(), en lugar de ser un metodo de Math objeto que creas (Math no es un constructor).
Math.tanh()Math.tanh(0); // 0
Math.tanh(Infinity); // 1
Math.tanh(1); // 0.7615941559557649
Esto puede ser emulado con ayuda de Math.exp() funcion:
Math.tanh =
Math.tanh ||
function (x) {
var a = Math.exp(+x),
b = Math.exp(-x);
return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (a + b);
};
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-math.tanh |
This page was last modified on 11 feb 2025 by MDN contributors.
MathMath.abs()Math.acos()Math.acosh()Math.asin()Math.asinh()Math.atan()Math.atan2()Math.atanh()Math.cbrt()Math.ceil()clz32()Math.cos()cosh()Math.exp()Math.expm1()f16round()Math.floor()fround()Math.hypot()imul()Math.log()log1p()Math.log2()Math.log10()Math.max()Math.min()Math.pow()Math.random()Math.round()Math.sign()Math.sin()sinh()Math.sqrt()sumPrecise()Math.tan()Math.tanh()Math.trunc()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |