Average Error: 58.4 → 0.0
Time: 20.7s
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 r2245339 = x;
        double r2245340 = exp(r2245339);
        double r2245341 = -r2245339;
        double r2245342 = exp(r2245341);
        double r2245343 = r2245340 - r2245342;
        double r2245344 = r2245340 + r2245342;
        double r2245345 = r2245343 / r2245344;
        return r2245345;
}

double f(double x) {
        double r2245346 = x;
        double r2245347 = tanh(r2245346);
        return r2245347;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.4

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