Average Error: 58.2 → 0.0
Time: 4.4s
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 r59982 = x;
        double r59983 = exp(r59982);
        double r59984 = -r59982;
        double r59985 = exp(r59984);
        double r59986 = r59983 - r59985;
        double r59987 = r59983 + r59985;
        double r59988 = r59986 / r59987;
        return r59988;
}

double f(double x) {
        double r59989 = x;
        double r59990 = tanh(r59989);
        return r59990;
}

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