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




Bits error versus wj




Bits error versus x
Results
| Original | 13.7 |
|---|---|
| Target | 13.2 |
| Herbie | 1.9 |
Initial program 13.7
Simplified13.2
Taylor expanded in wj around 0 1.9
Final simplification1.9
herbie shell --seed 2021215
(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))))))