Average Error: 0.0 → 0.2
Time: 9.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 r2566034 = 2.0;
        double r2566035 = x;
        double r2566036 = exp(r2566035);
        double r2566037 = -r2566035;
        double r2566038 = exp(r2566037);
        double r2566039 = r2566036 + r2566038;
        double r2566040 = r2566034 / r2566039;
        return r2566040;
}

double f(double x) {
        double r2566041 = 2.0;
        double r2566042 = x;
        double r2566043 = exp(r2566042);
        double r2566044 = -r2566042;
        double r2566045 = exp(r2566044);
        double r2566046 = r2566043 + r2566045;
        double r2566047 = r2566041 / r2566046;
        double r2566048 = exp(r2566047);
        double r2566049 = log(r2566048);
        return r2566049;
}

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