wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj \cdot x, -2, \mathsf{fma}\left(wj, wj, x\right)\right)double f(double wj, double x) {
double r9127884 = wj;
double r9127885 = exp(r9127884);
double r9127886 = r9127884 * r9127885;
double r9127887 = x;
double r9127888 = r9127886 - r9127887;
double r9127889 = r9127885 + r9127886;
double r9127890 = r9127888 / r9127889;
double r9127891 = r9127884 - r9127890;
return r9127891;
}
double f(double wj, double x) {
double r9127892 = wj;
double r9127893 = x;
double r9127894 = r9127892 * r9127893;
double r9127895 = -2.0;
double r9127896 = fma(r9127892, r9127892, r9127893);
double r9127897 = fma(r9127894, r9127895, r9127896);
return r9127897;
}




Bits error versus wj




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