Average Error: 58.4 → 0.0
Time: 19.5s
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 r3174431 = x;
        double r3174432 = exp(r3174431);
        double r3174433 = -r3174431;
        double r3174434 = exp(r3174433);
        double r3174435 = r3174432 - r3174434;
        double r3174436 = r3174432 + r3174434;
        double r3174437 = r3174435 / r3174436;
        return r3174437;
}

double f(double x) {
        double r3174438 = x;
        double r3174439 = tanh(r3174438);
        return r3174439;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.4

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