wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{wj + 1}}{e^{wj}} + \mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right)double f(double wj, double x) {
double r206983 = wj;
double r206984 = exp(r206983);
double r206985 = r206983 * r206984;
double r206986 = x;
double r206987 = r206985 - r206986;
double r206988 = r206984 + r206985;
double r206989 = r206987 / r206988;
double r206990 = r206983 - r206989;
return r206990;
}
double f(double wj, double x) {
double r206991 = x;
double r206992 = wj;
double r206993 = 1.0;
double r206994 = r206992 + r206993;
double r206995 = r206991 / r206994;
double r206996 = exp(r206992);
double r206997 = r206995 / r206996;
double r206998 = 4.0;
double r206999 = pow(r206992, r206998);
double r207000 = 3.0;
double r207001 = pow(r206992, r207000);
double r207002 = r206999 - r207001;
double r207003 = fma(r206992, r206992, r207002);
double r207004 = r206997 + r207003;
return r207004;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 0.9 |
Initial program 13.8
Simplified13.2
rmApplied associate--l+6.9
Taylor expanded around 0 0.9
Simplified0.9
Final simplification0.9
herbie shell --seed 2020056 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))