Average Error: 58.0 → 0.0
Time: 34.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 r11524551 = x;
        double r11524552 = exp(r11524551);
        double r11524553 = -r11524551;
        double r11524554 = exp(r11524553);
        double r11524555 = r11524552 - r11524554;
        double r11524556 = r11524552 + r11524554;
        double r11524557 = r11524555 / r11524556;
        return r11524557;
}

double f(double x) {
        double r11524558 = x;
        double r11524559 = tanh(r11524558);
        return r11524559;
}

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