compile with tanh.c -o tanh -lm
#include <stdio.h> /* including standard library */ //#include <windows.h> /* uncomment this for Windows */ #include <math.h> /* including math library */ int main( void ) { double x; x = log(42); printf ("hyperbolic tangent of 42 is %lf\n", tanh (x) ); return 0; }
output: user@host:~$ ./tanh hyperbolic tangent of 42 is 0.998867