Average Error: 58.1 → 0.0
Time: 24.1s
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 r52948 = x;
        double r52949 = exp(r52948);
        double r52950 = -r52948;
        double r52951 = exp(r52950);
        double r52952 = r52949 - r52951;
        double r52953 = r52949 + r52951;
        double r52954 = r52952 / r52953;
        return r52954;
}

double f(double x) {
        double r52955 = x;
        double r52956 = tanh(r52955);
        return r52956;
}

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