Average Error: 58.1 → 0.0
Time: 4.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 r32738 = x;
        double r32739 = exp(r32738);
        double r32740 = -r32738;
        double r32741 = exp(r32740);
        double r32742 = r32739 - r32741;
        double r32743 = r32739 + r32741;
        double r32744 = r32742 / r32743;
        return r32744;
}

double f(double x) {
        double r32745 = x;
        double r32746 = tanh(r32745);
        return r32746;
}

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