Average Error: 0.0 → 0.2
Time: 10.2s
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 r2169276 = 2.0;
        double r2169277 = x;
        double r2169278 = exp(r2169277);
        double r2169279 = -r2169277;
        double r2169280 = exp(r2169279);
        double r2169281 = r2169278 + r2169280;
        double r2169282 = r2169276 / r2169281;
        return r2169282;
}

double f(double x) {
        double r2169283 = 2.0;
        double r2169284 = x;
        double r2169285 = exp(r2169284);
        double r2169286 = -r2169284;
        double r2169287 = exp(r2169286);
        double r2169288 = r2169285 + r2169287;
        double r2169289 = r2169283 / r2169288;
        double r2169290 = exp(r2169289);
        double r2169291 = log(r2169290);
        return r2169291;
}

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)))))