\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 r120050 = 1.0;
double r120051 = x;
double r120052 = exp(r120051);
double r120053 = r120050 + r120052;
double r120054 = log(r120053);
double r120055 = y;
double r120056 = r120051 * r120055;
double r120057 = r120054 - r120056;
return r120057;
}
double f(double x, double y) {
double r120058 = y;
double r120059 = x;
double r120060 = -r120059;
double r120061 = 1.0;
double r120062 = exp(r120059);
double r120063 = r120061 + r120062;
double r120064 = log(r120063);
double r120065 = fma(r120058, r120060, r120064);
return r120065;
}




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