Open MBHelectronics opened 6 years ago
double tanh(double x) { double x0 = exp(x); double x1 = 1.0 / x0; return ((x0 + x1) / (x0 - x1)); }
Should be: return ((x0 - x1) / (x0 + x1)); see e.g. https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions
return ((x0 - x1) / (x0 + x1));
Thanks for spotting it, I fixed it in source now. I think also binary library has to be rebuilt for this change to take effect.
Should be:
return ((x0 - x1) / (x0 + x1));
see e.g. https://en.wikipedia.org/wiki/Hyperbolic_function#Definitions