Average Error: 58.3 → 0.0
Time: 27.0s
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 r48302 = x;
        double r48303 = exp(r48302);
        double r48304 = -r48302;
        double r48305 = exp(r48304);
        double r48306 = r48303 - r48305;
        double r48307 = r48303 + r48305;
        double r48308 = r48306 / r48307;
        return r48308;
}

double f(double x) {
        double r48309 = x;
        double r48310 = tanh(r48309);
        return r48310;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 58.3

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