Average Error: 58.0 → 0.0
Time: 18.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 r50588 = x;
        double r50589 = exp(r50588);
        double r50590 = -r50588;
        double r50591 = exp(r50590);
        double r50592 = r50589 - r50591;
        double r50593 = r50589 + r50591;
        double r50594 = r50592 / r50593;
        return r50594;
}

double f(double x) {
        double r50595 = x;
        double r50596 = tanh(r50595);
        return r50596;
}

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