Funkcja JavaScript Math.tanh () zwraca hiperboliczną tangens liczby.
Jest to równoważne z (e x - e -x ) / (e x + e -x ) w matematyce.
Składnia Math.tanh()
funkcji to:
Math.tanh(x)
tanh()
jako metoda statyczna jest wywoływana przy użyciu Math
nazwy klasy.
Parametry Math.tanh ()
Math.tanh()
Funkcja przyjmuje się:
- x - liczba
Wartość zwracana z Math.tanh ()
- Zwraca tangens hiperboliczny dla podanej liczby.
Przykład: użycie Math.tanh ()
// Math.tanh(x) is (e**(x) - e**(-x))/(e**(x) + e**(-x)) var num = Math.tanh(0); console.log(num); // 0 var num = Math.tanh(1); console.log(num); // 0.7615941559557649 var num = Math.tanh(-1); console.log(num); // -0.7615941559557649 var num = Math.tanh(2); console.log(num); // 0.9640275800758169
Wynik
0 0,7615941559557649 -0,7615941559557649 0,9640275800758169
Zalecane lektury:
- JavaScript Math atanh ()
- JavaScript Math sinh ()