\log \left(1 + e^{x}\right) - x \cdot y\mathsf{fma}\left(-x, y, \log \left(e^{x} + 1\right)\right)double f(double x, double y) {
double r131612 = 1.0;
double r131613 = x;
double r131614 = exp(r131613);
double r131615 = r131612 + r131614;
double r131616 = log(r131615);
double r131617 = y;
double r131618 = r131613 * r131617;
double r131619 = r131616 - r131618;
return r131619;
}
double f(double x, double y) {
double r131620 = x;
double r131621 = -r131620;
double r131622 = y;
double r131623 = exp(r131620);
double r131624 = 1.0;
double r131625 = r131623 + r131624;
double r131626 = log(r131625);
double r131627 = fma(r131621, r131622, r131626);
return r131627;
}




Bits error versus x




Bits error versus y
| Original | 0.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.5 |
Initial program 0.5
rmApplied add-sqr-sqrt1.3
Applied log-prod1.0
Taylor expanded around inf 1.0
Simplified0.5
Final simplification0.5
herbie shell --seed 2019305 +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)))