\log \left(1 + e^{x}\right) - x \cdot y\log \left(\sqrt{1 + e^{x}}\right) + \left(\log \left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 + e^{x}\right)\right)}\right) - y \cdot x\right)double f(double x, double y) {
double r5108702 = 1.0;
double r5108703 = x;
double r5108704 = exp(r5108703);
double r5108705 = r5108702 + r5108704;
double r5108706 = log(r5108705);
double r5108707 = y;
double r5108708 = r5108703 * r5108707;
double r5108709 = r5108706 - r5108708;
return r5108709;
}
double f(double x, double y) {
double r5108710 = 1.0;
double r5108711 = x;
double r5108712 = exp(r5108711);
double r5108713 = r5108710 + r5108712;
double r5108714 = sqrt(r5108713);
double r5108715 = log(r5108714);
double r5108716 = log1p(r5108713);
double r5108717 = expm1(r5108716);
double r5108718 = sqrt(r5108717);
double r5108719 = log(r5108718);
double r5108720 = y;
double r5108721 = r5108720 * r5108711;
double r5108722 = r5108719 - r5108721;
double r5108723 = r5108715 + r5108722;
return r5108723;
}




Bits error versus x




Bits error versus y
Results
| Original | 0.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.5 |
Initial program 0.5
rmApplied add-sqr-sqrt1.3
Applied log-prod1.0
Applied associate--l+1.0
rmApplied expm1-log1p-u0.5
Final simplification0.5
herbie shell --seed 2019174 +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)))