wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}x + \left(\sqrt[3]{wj} \cdot \sqrt[3]{wj}\right) \cdot \left(\sqrt[3]{wj} \cdot \left(wj - x \cdot 2\right)\right)(FPCore (wj x) :precision binary64 (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))
(FPCore (wj x) :precision binary64 (+ x (* (* (cbrt wj) (cbrt wj)) (* (cbrt wj) (- wj (* x 2.0))))))
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 + ((cbrt(wj) * cbrt(wj)) * (cbrt(wj) * (wj - (x * 2.0))));
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.3 |
Initial program 13.8
Taylor expanded around 0 2.1
Simplified2.1
rmApplied add-cube-cbrt_binary64_5612.3
Applied associate-*l*_binary64_6502.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2020233
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))