\log \left(1 + e^{x}\right) - x \cdot y\left(\log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)\right) - x \cdot ydouble f(double x, double y) {
double r98670 = 1.0;
double r98671 = x;
double r98672 = exp(r98671);
double r98673 = r98670 + r98672;
double r98674 = log(r98673);
double r98675 = y;
double r98676 = r98671 * r98675;
double r98677 = r98674 - r98676;
return r98677;
}
double f(double x, double y) {
double r98678 = 1.0;
double r98679 = x;
double r98680 = exp(r98679);
double r98681 = r98678 + r98680;
double r98682 = sqrt(r98681);
double r98683 = log(r98682);
double r98684 = r98683 + r98683;
double r98685 = y;
double r98686 = r98679 * r98685;
double r98687 = r98684 - r98686;
return r98687;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.5 |
|---|---|
| Target | 0.1 |
| Herbie | 1.1 |
Initial program 0.5
rmApplied add-sqr-sqrt1.4
Applied log-prod1.1
Final simplification1.1
herbie shell --seed 2019212 +o rules:numerics
(FPCore (x y)
:name "Logistic regression 2"
:precision binary64
:herbie-target
(if (<= x 0.0) (- (log (+ 1 (exp x))) (* x y)) (- (log (+ 1 (exp (- x)))) (* (- x) (- 1 y))))
(- (log (+ 1 (exp x))) (* x y)))