Average Error: 0.0 → 0.2
Time: 9.4s
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 r2430516 = 2.0;
        double r2430517 = x;
        double r2430518 = exp(r2430517);
        double r2430519 = -r2430517;
        double r2430520 = exp(r2430519);
        double r2430521 = r2430518 + r2430520;
        double r2430522 = r2430516 / r2430521;
        return r2430522;
}

double f(double x) {
        double r2430523 = 2.0;
        double r2430524 = x;
        double r2430525 = exp(r2430524);
        double r2430526 = -r2430524;
        double r2430527 = exp(r2430526);
        double r2430528 = r2430525 + r2430527;
        double r2430529 = r2430523 / r2430528;
        double r2430530 = exp(r2430529);
        double r2430531 = log(r2430530);
        return r2430531;
}

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 2019158 +o rules:numerics
(FPCore (x)
  :name "Hyperbolic secant"
  (/ 2 (+ (exp x) (exp (- x)))))