Average Error: 0.0 → 0.8
Time: 6.1s
Precision: 64
\[\frac{1}{1 + e^{-x}}\]
\[\frac{\sqrt{1}}{\sqrt{1 + e^{-x}}} \cdot \frac{\sqrt{1}}{\sqrt{1 + e^{-x}}}\]
\frac{1}{1 + e^{-x}}
\frac{\sqrt{1}}{\sqrt{1 + e^{-x}}} \cdot \frac{\sqrt{1}}{\sqrt{1 + e^{-x}}}
double f(double x) {
        double r98525 = 1.0;
        double r98526 = x;
        double r98527 = -r98526;
        double r98528 = exp(r98527);
        double r98529 = r98525 + r98528;
        double r98530 = r98525 / r98529;
        return r98530;
}

double f(double x) {
        double r98531 = 1.0;
        double r98532 = sqrt(r98531);
        double r98533 = x;
        double r98534 = -r98533;
        double r98535 = exp(r98534);
        double r98536 = r98531 + r98535;
        double r98537 = sqrt(r98536);
        double r98538 = r98532 / r98537;
        double r98539 = r98538 * r98538;
        return r98539;
}

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

    \[\leadsto \frac{1}{\color{blue}{\sqrt{1 + e^{-x}} \cdot \sqrt{1 + e^{-x}}}}\]
  4. Applied add-sqr-sqrt0.8

    \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{\sqrt{1 + e^{-x}} \cdot \sqrt{1 + e^{-x}}}\]
  5. Applied times-frac0.8

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

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

Reproduce

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