Average Error: 58.0 → 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 r2913299 = x;
        double r2913300 = exp(r2913299);
        double r2913301 = -r2913299;
        double r2913302 = exp(r2913301);
        double r2913303 = r2913300 - r2913302;
        double r2913304 = r2913300 + r2913302;
        double r2913305 = r2913303 / r2913304;
        return r2913305;
}

double f(double x) {
        double r2913306 = x;
        double r2913307 = tanh(r2913306);
        return r2913307;
}

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