Average Error: 0.0 → 0.5
Time: 7.9s
Precision: 64
\[\frac{1}{1 + e^{-x}}\]
\[\sqrt{\frac{1}{e^{-x} + 1}} \cdot \sqrt{\frac{1}{e^{-x} + 1}}\]
\frac{1}{1 + e^{-x}}
\sqrt{\frac{1}{e^{-x} + 1}} \cdot \sqrt{\frac{1}{e^{-x} + 1}}
double f(double x) {
        double r30955352 = 1.0;
        double r30955353 = x;
        double r30955354 = -r30955353;
        double r30955355 = exp(r30955354);
        double r30955356 = r30955352 + r30955355;
        double r30955357 = r30955352 / r30955356;
        return r30955357;
}

double f(double x) {
        double r30955358 = 1.0;
        double r30955359 = x;
        double r30955360 = -r30955359;
        double r30955361 = exp(r30955360);
        double r30955362 = r30955361 + r30955358;
        double r30955363 = r30955358 / r30955362;
        double r30955364 = sqrt(r30955363);
        double r30955365 = r30955364 * r30955364;
        return r30955365;
}

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{1}{1 + e^{-x}}\]
  2. Using strategy rm
  3. Applied add-sqr-sqrt0.5

    \[\leadsto \color{blue}{\sqrt{\frac{1}{1 + e^{-x}}} \cdot \sqrt{\frac{1}{1 + e^{-x}}}}\]
  4. Final simplification0.5

    \[\leadsto \sqrt{\frac{1}{e^{-x} + 1}} \cdot \sqrt{\frac{1}{e^{-x} + 1}}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "1 / (1 + exp(-x))"
  (/ 1.0 (+ 1.0 (exp (- x)))))