\log \left(1 + e^{x}\right) - x \cdot y\mathsf{fma}\left(-y, x, \log \left(\sqrt{1 + e^{x}}\right) + \log \left(\sqrt{1 + e^{x}}\right)\right)double f(double x, double y) {
double r164235 = 1.0;
double r164236 = x;
double r164237 = exp(r164236);
double r164238 = r164235 + r164237;
double r164239 = log(r164238);
double r164240 = y;
double r164241 = r164236 * r164240;
double r164242 = r164239 - r164241;
return r164242;
}
double f(double x, double y) {
double r164243 = y;
double r164244 = -r164243;
double r164245 = x;
double r164246 = 1.0;
double r164247 = exp(r164245);
double r164248 = r164246 + r164247;
double r164249 = sqrt(r164248);
double r164250 = log(r164249);
double r164251 = r164250 + r164250;
double r164252 = fma(r164244, r164245, r164251);
return r164252;
}




Bits error versus x




Bits error versus y
| Original | 0.5 |
|---|---|
| Target | 0.0 |
| Herbie | 1.0 |
Initial program 0.5
Simplified0.5
rmApplied add-sqr-sqrt1.3
Applied log-prod1.0
Final simplification1.0
herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
:name "Logistic regression 2"
:herbie-target
(if (<= x 0.0) (- (log (+ 1.0 (exp x))) (* x y)) (- (log (+ 1.0 (exp (- x)))) (* (- x) (- 1.0 y))))
(- (log (+ 1.0 (exp x))) (* x y)))