Average Error: 0.0 → 0.2
Time: 10.7s
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 r2043384 = 2.0;
        double r2043385 = x;
        double r2043386 = exp(r2043385);
        double r2043387 = -r2043385;
        double r2043388 = exp(r2043387);
        double r2043389 = r2043386 + r2043388;
        double r2043390 = r2043384 / r2043389;
        return r2043390;
}

double f(double x) {
        double r2043391 = 2.0;
        double r2043392 = x;
        double r2043393 = exp(r2043392);
        double r2043394 = -r2043392;
        double r2043395 = exp(r2043394);
        double r2043396 = r2043393 + r2043395;
        double r2043397 = r2043391 / r2043396;
        double r2043398 = exp(r2043397);
        double r2043399 = log(r2043398);
        return r2043399;
}

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