Average Error: 58.2 → 0.0
Time: 5.1s
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 r39675 = x;
        double r39676 = exp(r39675);
        double r39677 = -r39675;
        double r39678 = exp(r39677);
        double r39679 = r39676 - r39678;
        double r39680 = r39676 + r39678;
        double r39681 = r39679 / r39680;
        return r39681;
}

double f(double x) {
        double r39682 = x;
        double r39683 = tanh(r39682);
        return r39683;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.2

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