Average Error: 58.0 → 0.0
Time: 18.2s
Precision: 64
\[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
\[\tanh x\]
\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}
\tanh x
double f(double x) {
        double r2767374 = x;
        double r2767375 = exp(r2767374);
        double r2767376 = -r2767374;
        double r2767377 = exp(r2767376);
        double r2767378 = r2767375 - r2767377;
        double r2767379 = r2767375 + r2767377;
        double r2767380 = r2767378 / r2767379;
        return r2767380;
}

double f(double x) {
        double r2767381 = x;
        double r2767382 = tanh(r2767381);
        return r2767382;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.0

    \[\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}\]
  2. Using strategy rm
  3. Applied tanh-undef0.0

    \[\leadsto \color{blue}{\tanh x}\]
  4. Final simplification0.0

    \[\leadsto \tanh x\]

Reproduce

herbie shell --seed 2019163 
(FPCore (x)
  :name "Hyperbolic tangent"
  (/ (- (exp x) (exp (- x))) (+ (exp x) (exp (- x)))))