wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}x + \left(\left(x \cdot 2.5 + 1\right) \cdot \left(wj \cdot wj\right) - \left({wj}^{3} + x \cdot \left(\left(wj + wj\right) + {wj}^{3} \cdot 2.6666666666666665\right)\right)\right)(FPCore (wj x) :precision binary64 (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))
(FPCore (wj x) :precision binary64 (+ x (- (* (+ (* x 2.5) 1.0) (* wj wj)) (+ (pow wj 3.0) (* x (+ (+ wj wj) (* (pow wj 3.0) 2.6666666666666665)))))))
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 + ((((x * 2.5) + 1.0) * (wj * wj)) - (pow(wj, 3.0) + (x * ((wj + wj) + (pow(wj, 3.0) * 2.6666666666666665)))));
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.7 |
|---|---|
| Target | 13.1 |
| Herbie | 1.6 |
Initial program 13.7
Simplified13.1
Taylor expanded around 0 1.5
Simplified1.6
Final simplification1.6
herbie shell --seed 2021174
(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))))))