Average Error: 58.2 → 0.0
Time: 15.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 r799939 = x;
        double r799940 = exp(r799939);
        double r799941 = -r799939;
        double r799942 = exp(r799941);
        double r799943 = r799940 - r799942;
        double r799944 = r799940 + r799942;
        double r799945 = r799943 / r799944;
        return r799945;
}

double f(double x) {
        double r799946 = x;
        double r799947 = tanh(r799946);
        return r799947;
}

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