wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}x + wj \cdot \left(wj - 2 \cdot x\right)
double f(double wj, double x) {
double r234620 = wj;
double r234621 = exp(r234620);
double r234622 = r234620 * r234621;
double r234623 = x;
double r234624 = r234622 - r234623;
double r234625 = r234621 + r234622;
double r234626 = r234624 / r234625;
double r234627 = r234620 - r234626;
return r234627;
}
double f(double wj, double x) {
double r234628 = x;
double r234629 = wj;
double r234630 = 2.0;
double r234631 = r234630 * r234628;
double r234632 = r234629 - r234631;
double r234633 = r234629 * r234632;
double r234634 = r234628 + r234633;
return r234634;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.1 |
|---|---|
| Target | 12.4 |
| Herbie | 2.3 |
Initial program 13.1
Simplified12.4
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019350
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))