\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 r117726 = 1.0;
double r117727 = x;
double r117728 = exp(r117727);
double r117729 = r117726 + r117728;
double r117730 = log(r117729);
double r117731 = y;
double r117732 = r117727 * r117731;
double r117733 = r117730 - r117732;
return r117733;
}
double f(double x, double y) {
double r117734 = y;
double r117735 = x;
double r117736 = -r117735;
double r117737 = 1.0;
double r117738 = exp(r117735);
double r117739 = r117737 + r117738;
double r117740 = log(r117739);
double r117741 = fma(r117734, r117736, r117740);
return r117741;
}




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)))