Average Error: 58.0 → 0.0
Time: 34.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 r3134686 = x;
        double r3134687 = exp(r3134686);
        double r3134688 = -r3134686;
        double r3134689 = exp(r3134688);
        double r3134690 = r3134687 - r3134689;
        double r3134691 = r3134687 + r3134689;
        double r3134692 = r3134690 / r3134691;
        return r3134692;
}

double f(double x) {
        double r3134693 = x;
        double r3134694 = tanh(r3134693);
        return r3134694;
}

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