\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 r89150 = 1.0;
double r89151 = x;
double r89152 = exp(r89151);
double r89153 = r89150 + r89152;
double r89154 = log(r89153);
double r89155 = y;
double r89156 = r89151 * r89155;
double r89157 = r89154 - r89156;
return r89157;
}
double f(double x, double y) {
double r89158 = y;
double r89159 = x;
double r89160 = -r89159;
double r89161 = 1.0;
double r89162 = exp(r89159);
double r89163 = r89161 + r89162;
double r89164 = log(r89163);
double r89165 = fma(r89158, r89160, r89164);
return r89165;
}




Bits error versus x




Bits error versus y
| Original | 0.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.5 |
Initial program 0.5
Taylor expanded around inf 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)))