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 r177871 = wj;
double r177872 = exp(r177871);
double r177873 = r177871 * r177872;
double r177874 = x;
double r177875 = r177873 - r177874;
double r177876 = r177872 + r177873;
double r177877 = r177875 / r177876;
double r177878 = r177871 - r177877;
return r177878;
}
double f(double wj, double x) {
double r177879 = wj;
double r177880 = x;
double r177881 = fma(r177879, r177879, r177880);
double r177882 = 2.0;
double r177883 = r177879 * r177880;
double r177884 = r177882 * r177883;
double r177885 = r177881 - r177884;
return r177885;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.2 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2019195 +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))))))