Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,894 questions

51,825 answers

573 users

How to use Math.tanh() to get the hyperbolic tangent of a number in JavaScript

1 Answer

0 votes
document.write("Math.tanh(45 * Math.PI / 180.0) = " + Math.tanh(45 * Math.PI / 180.0) + "<br />");
document.write("Math.tanh(3 * Math.PI / 4) = " + Math.tanh(3 * Math.PI / 4) + "<br />");
document.write("Math.tanh(5 * Math.PI / 4) = " + Math.tanh(5 * Math.PI / 4) + "<br />");
document.write("Math.tanh(7 * Math.PI / 4) = " + Math.tanh(7 * Math.PI / 4) + "<br />");
document.write("Math.tanh(Math.PI / 4) = " + Math.tanh(Math.PI / 4) + "<br />");
document.write("Math.tanh(0) = " + Math.tanh(0) + "<br />");
document.write("Math.tanh(-0) = " + Math.tanh(-0) + "<br />");
document.write("Math.tanh(1) = " + Math.tanh(1) + "<br />");
document.write("Math.tanh(Infinity) = " + Math.tanh(Infinity) + "<br />");

 
/*
run

Math.tanh(45 * Math.PI / 180.0) = 0.6557942026326724
Math.tanh(3 * Math.PI / 4) = 0.9821933800072388
Math.tanh(5 * Math.PI / 4) = 0.9992238948786412
Math.tanh(7 * Math.PI / 4) = 0.9999664489997958
Math.tanh(Math.PI / 4) = 0.6557942026326724
Math.tanh(0) = 0
Math.tanh(-0) = 0
Math.tanh(1) = 0.7615941559557649
Math.tanh(Infinity) = 1
 
*/

 



answered Aug 7, 2016 by avibootz
...