Average Error: 0.0 → 0.8
Time: 7.7s
Precision: 64
$\frac{1}{1 + e^{-x}}$
$\frac{1}{\sqrt{1 + e^{-x}}} \cdot \frac{1}{\sqrt{1 + e^{-x}}}$
\frac{1}{1 + e^{-x}}
\frac{1}{\sqrt{1 + e^{-x}}} \cdot \frac{1}{\sqrt{1 + e^{-x}}}
double f(double x) {
double r557503 = 1.0;
double r557504 = x;
double r557505 = -r557504;
double r557506 = exp(r557505);
double r557507 = r557503 + r557506;
double r557508 = r557503 / r557507;
return r557508;
}


double f(double x) {
double r557509 = 1.0;
double r557510 = 1.0;
double r557511 = x;
double r557512 = -r557511;
double r557513 = exp(r557512);
double r557514 = r557510 + r557513;
double r557515 = sqrt(r557514);
double r557516 = r557509 / r557515;
double r557517 = r557510 / r557515;
double r557518 = r557516 * r557517;
return r557518;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

$\frac{1}{1 + e^{-x}}$
2. Using strategy rm

$\leadsto \frac{1}{\color{blue}{\sqrt{1 + e^{-x}} \cdot \sqrt{1 + e^{-x}}}}$
4. Applied *-un-lft-identity0.8

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

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

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

# Reproduce

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