\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 r145970 = 1.0;
double r145971 = x;
double r145972 = exp(r145971);
double r145973 = r145970 + r145972;
double r145974 = log(r145973);
double r145975 = y;
double r145976 = r145971 * r145975;
double r145977 = r145974 - r145976;
return r145977;
}
double f(double x, double y) {
double r145978 = 1.0;
double r145979 = x;
double r145980 = exp(r145979);
double r145981 = r145978 + r145980;
double r145982 = sqrt(r145981);
double r145983 = log(r145982);
double r145984 = r145983 + r145983;
double r145985 = y;
double r145986 = r145979 * r145985;
double r145987 = r145984 - r145986;
return r145987;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.6 |
|---|---|
| Target | 0.1 |
| Herbie | 1.1 |
Initial program 0.6
rmApplied add-sqr-sqrt1.4
Applied log-prod1.1
Final simplification1.1
herbie shell --seed 2020035 +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)))