Average Error: 58.3 → 0.0
Time: 33.6s
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 r1723254 = x;
        double r1723255 = exp(r1723254);
        double r1723256 = -r1723254;
        double r1723257 = exp(r1723256);
        double r1723258 = r1723255 - r1723257;
        double r1723259 = r1723255 + r1723257;
        double r1723260 = r1723258 / r1723259;
        return r1723260;
}

double f(double x) {
        double r1723261 = x;
        double r1723262 = tanh(r1723261);
        return r1723262;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.3

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