Average Error: 58.4 → 0.0
Time: 22.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 r47144 = x;
        double r47145 = exp(r47144);
        double r47146 = -r47144;
        double r47147 = exp(r47146);
        double r47148 = r47145 - r47147;
        double r47149 = r47145 + r47147;
        double r47150 = r47148 / r47149;
        return r47150;
}

double f(double x) {
        double r47151 = x;
        double r47152 = tanh(r47151);
        return r47152;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.4

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