--- title: Math.tanh() slug: Web/JavaScript/Reference/Global_Objects/Math/tanh tags: - ECMAScript 2015 - 레퍼런스 - 메서드 - 수학 - 자바스크립트 translation_of: Web/JavaScript/Reference/Global_Objects/Math/tanh ---
Math.tanh() 함수는 쌍곡탄젠트 값을 반환합니다. 수식으로는 아래와 같습니다.
Math.tanh(x)
x주어진 수의 쌍곡탄젠트 값
tanh() 은 Math의 정적 메서드이므로 사용자가 만든 Math 객체의 메서드가 아닌 항상 Math.tanh() 으로 사용합니다 (Math 는 생성자가 아닙니다.).
Math.tanh()Math.tanh(0); // 0 Math.tanh(Infinity); // 1 Math.tanh(1); // 0.7615941559557649
This can be emulated with the help of the {{jsxref("Math.exp()")}} function:
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 |
|---|
| {{SpecName('ESDraft', '#sec-math.tanh', 'Math.tanh')}} |
{{Compat("javascript.builtins.Math.tanh")}}