4.3.2 Tanh
Last updated
Last updated
#include <stdio.h>
#include <math.h>
double tanh(double x) {
return (exp(x) - exp(-x)) / (exp(x) + exp(-x));
}
int main() {
double x = 0.5;
double y = tanh(x);
printf("The tanh of %f is %f\n", x, y);
return 0;
}The tanh of 0.500000 is 0.462117