Average Error: 0.0 → 0.2
Time: 6.1s
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 r32531 = 2.0;
        double r32532 = x;
        double r32533 = exp(r32532);
        double r32534 = -r32532;
        double r32535 = exp(r32534);
        double r32536 = r32533 + r32535;
        double r32537 = r32531 / r32536;
        return r32537;
}

double f(double x) {
        double r32538 = 2.0;
        double r32539 = x;
        double r32540 = exp(r32539);
        double r32541 = -r32539;
        double r32542 = exp(r32541);
        double r32543 = r32540 + r32542;
        double r32544 = r32538 / r32543;
        double r32545 = exp(r32544);
        double r32546 = log(r32545);
        return r32546;
}

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 2020043 
(FPCore (x)
  :name "Hyperbolic secant"
  :precision binary64
  (/ 2 (+ (exp x) (exp (- x)))))