Average Error: 58.1 → 0.0
Time: 9.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 r48361 = x;
        double r48362 = exp(r48361);
        double r48363 = -r48361;
        double r48364 = exp(r48363);
        double r48365 = r48362 - r48364;
        double r48366 = r48362 + r48364;
        double r48367 = r48365 / r48366;
        return r48367;
}

double f(double x) {
        double r48368 = x;
        double r48369 = tanh(r48368);
        return r48369;
}

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