\log \left(1 + e^{x}\right) - x \cdot y\log \left(\sqrt{1 + e^{x}}\right) + \left(\log \left(\sqrt{1 + e^{x}}\right) - x \cdot y\right)double f(double x, double y) {
double r182439 = 1.0;
double r182440 = x;
double r182441 = exp(r182440);
double r182442 = r182439 + r182441;
double r182443 = log(r182442);
double r182444 = y;
double r182445 = r182440 * r182444;
double r182446 = r182443 - r182445;
return r182446;
}
double f(double x, double y) {
double r182447 = 1.0;
double r182448 = x;
double r182449 = exp(r182448);
double r182450 = r182447 + r182449;
double r182451 = sqrt(r182450);
double r182452 = log(r182451);
double r182453 = y;
double r182454 = r182448 * r182453;
double r182455 = r182452 - r182454;
double r182456 = r182452 + r182455;
return r182456;
}




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
Applied associate--l+1.1
Final simplification1.1
herbie shell --seed 2020036 +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)))