wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)double code(double wj, double x) {
return (wj - (((wj * exp(wj)) - x) / (exp(wj) + (wj * exp(wj)))));
}
double code(double wj, double x) {
return ((x + pow(wj, 2.0)) - (2.0 * (wj * x)));
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.1 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.1
Final simplification2.1
herbie shell --seed 2020092
(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))))))