Average Error: 58.1 → 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 r35335 = x;
        double r35336 = exp(r35335);
        double r35337 = -r35335;
        double r35338 = exp(r35337);
        double r35339 = r35336 - r35338;
        double r35340 = r35336 + r35338;
        double r35341 = r35339 / r35340;
        return r35341;
}

double f(double x) {
        double r35342 = x;
        double r35343 = tanh(r35342);
        return r35343;
}

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