Average Error: 58.0 → 0.0
Time: 15.0s
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 r1395546 = x;
        double r1395547 = exp(r1395546);
        double r1395548 = -r1395546;
        double r1395549 = exp(r1395548);
        double r1395550 = r1395547 - r1395549;
        double r1395551 = r1395547 + r1395549;
        double r1395552 = r1395550 / r1395551;
        return r1395552;
}

double f(double x) {
        double r1395553 = x;
        double r1395554 = tanh(r1395553);
        return r1395554;
}

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