\log \left(1 + e^{x}\right) - x \cdot y\log \left(\frac{\mathsf{fma}\left(1, 1 \cdot 1, e^{\mathsf{fma}\left(2, x, x\right)}\right)}{\mathsf{fma}\left(1, 1, e^{x} \cdot \left(e^{x} - 1\right)\right)}\right) - x \cdot ydouble f(double x, double y) {
double r5987693 = 1.0;
double r5987694 = x;
double r5987695 = exp(r5987694);
double r5987696 = r5987693 + r5987695;
double r5987697 = log(r5987696);
double r5987698 = y;
double r5987699 = r5987694 * r5987698;
double r5987700 = r5987697 - r5987699;
return r5987700;
}
double f(double x, double y) {
double r5987701 = 1.0;
double r5987702 = r5987701 * r5987701;
double r5987703 = 2.0;
double r5987704 = x;
double r5987705 = fma(r5987703, r5987704, r5987704);
double r5987706 = exp(r5987705);
double r5987707 = fma(r5987701, r5987702, r5987706);
double r5987708 = exp(r5987704);
double r5987709 = r5987708 - r5987701;
double r5987710 = r5987708 * r5987709;
double r5987711 = fma(r5987701, r5987701, r5987710);
double r5987712 = r5987707 / r5987711;
double r5987713 = log(r5987712);
double r5987714 = y;
double r5987715 = r5987704 * r5987714;
double r5987716 = r5987713 - r5987715;
return r5987716;
}




Bits error versus x




Bits error versus y
| Original | 0.5 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
Initial program 0.5
rmApplied flip3-+0.5
Simplified0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2019170 +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)))