\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 r127584 = 1.0;
double r127585 = x;
double r127586 = exp(r127585);
double r127587 = r127584 + r127586;
double r127588 = log(r127587);
double r127589 = y;
double r127590 = r127585 * r127589;
double r127591 = r127588 - r127590;
return r127591;
}
double f(double x, double y) {
double r127592 = y;
double r127593 = x;
double r127594 = -r127593;
double r127595 = 1.0;
double r127596 = exp(r127593);
double r127597 = r127595 + r127596;
double r127598 = log(r127597);
double r127599 = fma(r127592, r127594, r127598);
return r127599;
}




Bits error versus x




Bits error versus y
| Original | 0.6 |
|---|---|
| Target | 0.1 |
| Herbie | 0.6 |
Initial program 0.6
Taylor expanded around inf 0.6
Simplified0.6
Final simplification0.6
herbie shell --seed 2019322 +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)))