wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - 2 \cdot \left(wj \cdot x\right)double f(double wj, double x) {
double r120518 = wj;
double r120519 = exp(r120518);
double r120520 = r120518 * r120519;
double r120521 = x;
double r120522 = r120520 - r120521;
double r120523 = r120519 + r120520;
double r120524 = r120522 / r120523;
double r120525 = r120518 - r120524;
return r120525;
}
double f(double wj, double x) {
double r120526 = wj;
double r120527 = x;
double r120528 = fma(r120526, r120526, r120527);
double r120529 = 2.0;
double r120530 = r120526 * r120527;
double r120531 = r120529 * r120530;
double r120532 = r120528 - r120531;
return r120532;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.1 |
Initial program 13.8
Simplified13.2
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019194 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))