Average Error: 0.0 → 0.1
Time: 33.6s
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 r4796913 = 2.0;
        double r4796914 = x;
        double r4796915 = exp(r4796914);
        double r4796916 = -r4796914;
        double r4796917 = exp(r4796916);
        double r4796918 = r4796915 + r4796917;
        double r4796919 = r4796913 / r4796918;
        return r4796919;
}

double f(double x) {
        double r4796920 = 2.0;
        double r4796921 = x;
        double r4796922 = exp(r4796921);
        double r4796923 = -r4796921;
        double r4796924 = exp(r4796923);
        double r4796925 = r4796922 + r4796924;
        double r4796926 = r4796920 / r4796925;
        double r4796927 = exp(r4796926);
        double r4796928 = log(r4796927);
        return r4796928;
}

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.1

    \[\leadsto \color{blue}{\log \left(e^{\frac{2}{e^{x} + e^{-x}}}\right)}\]
  4. Final simplification0.1

    \[\leadsto \log \left(e^{\frac{2}{e^{x} + e^{-x}}}\right)\]

Reproduce

herbie shell --seed 2019119 
(FPCore (x)
  :name "Hyperbolic secant"
  (/ 2 (+ (exp x) (exp (- x)))))