Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expression for tanh in tanh.c is incorrect #31

Open
MBHelectronics opened this issue May 16, 2018 · 1 comment
Open

Expression for tanh in tanh.c is incorrect #31

MBHelectronics opened this issue May 16, 2018 · 1 comment

Comments

@MBHelectronics
Copy link

MBHelectronics commented May 16, 2018

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

@emard
Copy link
Member

emard commented May 16, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants