\log \left(1 + e^{x}\right) - x \cdot y\begin{array}{l}
\mathbf{if}\;x \le -0.00109385259927722201:\\
\;\;\;\;e^{\log \left(\log \left(1 \cdot 1 - e^{x} \cdot e^{x}\right) - \log \left(1 - e^{x}\right)\right)} - x \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\log 2 + {x}^{2} \cdot \left(0.25 - \frac{\frac{1}{2}}{{2}^{2}}\right)\right) + 0.5 \cdot x\right) - x \cdot y\\
\end{array}double code(double x, double y) {
return ((double) (((double) log(((double) (1.0 + ((double) exp(x)))))) - ((double) (x * y))));
}
double code(double x, double y) {
double VAR;
if ((x <= -0.001093852599277222)) {
VAR = ((double) (((double) exp(((double) log(((double) (((double) log(((double) (((double) (1.0 * 1.0)) - ((double) (((double) exp(x)) * ((double) exp(x)))))))) - ((double) log(((double) (1.0 - ((double) exp(x)))))))))))) - ((double) (x * y))));
} else {
VAR = ((double) (((double) (((double) (((double) log(2.0)) + ((double) (((double) pow(x, 2.0)) * ((double) (0.25 - ((double) (0.5 / ((double) pow(2.0, 2.0)))))))))) + ((double) (0.5 * x)))) - ((double) (x * y))));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.5 |
|---|---|
| Target | 0.0 |
| Herbie | 0.3 |
if x < -0.00109385259927722201Initial program 0.1
rmApplied flip-+0.1
Applied log-div0.1
rmApplied add-exp-log0.1
if -0.00109385259927722201 < x Initial program 0.6
Taylor expanded around 0 0.4
Simplified0.4
Final simplification0.3
herbie shell --seed 2020153
(FPCore (x y)
:name "Logistic regression 2"
:precision binary64
:herbie-target
(if (<= x 0.0) (- (log (+ 1.0 (exp x))) (* x y)) (- (log (+ 1.0 (exp (neg x)))) (* (neg x) (- 1.0 y))))
(- (log (+ 1.0 (exp x))) (* x y)))