Average Error: 0.0 → 0.2
Time: 9.9s
Precision: 64
\[\frac{2}{e^{x} + e^{-x}}\]
\[\log \left(e^{\frac{2}{e^{x} + e^{-x}}}\right)\]
\frac{2}{e^{x} + e^{-x}}
\log \left(e^{\frac{2}{e^{x} + e^{-x}}}\right)
double f(double x) {
        double r1922543 = 2.0;
        double r1922544 = x;
        double r1922545 = exp(r1922544);
        double r1922546 = -r1922544;
        double r1922547 = exp(r1922546);
        double r1922548 = r1922545 + r1922547;
        double r1922549 = r1922543 / r1922548;
        return r1922549;
}

double f(double x) {
        double r1922550 = 2.0;
        double r1922551 = x;
        double r1922552 = exp(r1922551);
        double r1922553 = -r1922551;
        double r1922554 = exp(r1922553);
        double r1922555 = r1922552 + r1922554;
        double r1922556 = r1922550 / r1922555;
        double r1922557 = exp(r1922556);
        double r1922558 = log(r1922557);
        return r1922558;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[\frac{2}{e^{x} + e^{-x}}\]
  2. Using strategy rm
  3. Applied add-log-exp0.2

    \[\leadsto \color{blue}{\log \left(e^{\frac{2}{e^{x} + e^{-x}}}\right)}\]
  4. Final simplification0.2

    \[\leadsto \log \left(e^{\frac{2}{e^{x} + e^{-x}}}\right)\]

Reproduce

herbie shell --seed 2019192 
(FPCore (x)
  :name "Hyperbolic secant"
  (/ 2.0 (+ (exp x) (exp (- x)))))