\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 r81524 = 1.0;
double r81525 = x;
double r81526 = exp(r81525);
double r81527 = r81524 + r81526;
double r81528 = log(r81527);
double r81529 = y;
double r81530 = r81525 * r81529;
double r81531 = r81528 - r81530;
return r81531;
}
double f(double x, double y) {
double r81532 = y;
double r81533 = -r81532;
double r81534 = x;
double r81535 = 1.0;
double r81536 = exp(r81534);
double r81537 = r81535 + r81536;
double r81538 = log(r81537);
double r81539 = fma(r81533, r81534, r81538);
return r81539;
}




Bits error versus x




Bits error versus y
| Original | 0.6 |
|---|---|
| Target | 0.1 |
| Herbie | 0.6 |
Initial program 0.6
rmApplied pow10.6
Applied log-pow0.6
Applied prod-diff0.6
Simplified0.6
Simplified0.6
Final simplification0.6
herbie shell --seed 2019347 +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)))