Average Error: 58.1 → 0.0
Time: 21.9s
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 r4417541 = x;
        double r4417542 = exp(r4417541);
        double r4417543 = -r4417541;
        double r4417544 = exp(r4417543);
        double r4417545 = r4417542 - r4417544;
        double r4417546 = r4417542 + r4417544;
        double r4417547 = r4417545 / r4417546;
        return r4417547;
}

double f(double x) {
        double r4417548 = x;
        double r4417549 = tanh(r4417548);
        return r4417549;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.1

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