Average Error: 58.1 → 0.0
Time: 17.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 r2965543 = x;
        double r2965544 = exp(r2965543);
        double r2965545 = -r2965543;
        double r2965546 = exp(r2965545);
        double r2965547 = r2965544 - r2965546;
        double r2965548 = r2965544 + r2965546;
        double r2965549 = r2965547 / r2965548;
        return r2965549;
}

double f(double x) {
        double r2965550 = x;
        double r2965551 = tanh(r2965550);
        return r2965551;
}

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