Average Error: 58.0 → 0.0
Time: 39.3s
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 r2956119 = x;
        double r2956120 = exp(r2956119);
        double r2956121 = -r2956119;
        double r2956122 = exp(r2956121);
        double r2956123 = r2956120 - r2956122;
        double r2956124 = r2956120 + r2956122;
        double r2956125 = r2956123 / r2956124;
        return r2956125;
}

double f(double x) {
        double r2956126 = x;
        double r2956127 = tanh(r2956126);
        return r2956127;
}

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 2019200 
(FPCore (x)
  :name "Hyperbolic tangent"
  (/ (- (exp x) (exp (- x))) (+ (exp x) (exp (- x)))))