Average Error: 58.1 → 0.0
Time: 40.4s
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 r2306331 = x;
        double r2306332 = exp(r2306331);
        double r2306333 = -r2306331;
        double r2306334 = exp(r2306333);
        double r2306335 = r2306332 - r2306334;
        double r2306336 = r2306332 + r2306334;
        double r2306337 = r2306335 / r2306336;
        return r2306337;
}

double f(double x) {
        double r2306338 = x;
        double r2306339 = tanh(r2306338);
        return r2306339;
}

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