\log \left(1 + e^{x}\right) - x \cdot y\mathsf{fma}\left(y, -x, \log \left(1 + e^{x}\right)\right)double f(double x, double y) {
double r88365 = 1.0;
double r88366 = x;
double r88367 = exp(r88366);
double r88368 = r88365 + r88367;
double r88369 = log(r88368);
double r88370 = y;
double r88371 = r88366 * r88370;
double r88372 = r88369 - r88371;
return r88372;
}
double f(double x, double y) {
double r88373 = y;
double r88374 = x;
double r88375 = -r88374;
double r88376 = 1.0;
double r88377 = exp(r88374);
double r88378 = r88376 + r88377;
double r88379 = log(r88378);
double r88380 = fma(r88373, r88375, r88379);
return r88380;
}




Bits error versus x




Bits error versus y
| Original | 0.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.5 |
Initial program 0.5
rmApplied *-un-lft-identity0.5
Applied log-prod0.5
Applied associate--l+0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2019323 +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)))