Average Error: 58.1 → 0.0
Time: 23.8s
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 r34428 = x;
        double r34429 = exp(r34428);
        double r34430 = -r34428;
        double r34431 = exp(r34430);
        double r34432 = r34429 - r34431;
        double r34433 = r34429 + r34431;
        double r34434 = r34432 / r34433;
        return r34434;
}

double f(double x) {
        double r34435 = x;
        double r34436 = tanh(r34435);
        return r34436;
}

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