wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(\left({wj}^{4} + {wj}^{2}\right) - {wj}^{3}\right) + \frac{\frac{x}{e^{wj}}}{wj + 1}double f(double wj, double x) {
double r183972 = wj;
double r183973 = exp(r183972);
double r183974 = r183972 * r183973;
double r183975 = x;
double r183976 = r183974 - r183975;
double r183977 = r183973 + r183974;
double r183978 = r183976 / r183977;
double r183979 = r183972 - r183978;
return r183979;
}
double f(double wj, double x) {
double r183980 = wj;
double r183981 = 4.0;
double r183982 = pow(r183980, r183981);
double r183983 = 2.0;
double r183984 = pow(r183980, r183983);
double r183985 = r183982 + r183984;
double r183986 = 3.0;
double r183987 = pow(r183980, r183986);
double r183988 = r183985 - r183987;
double r183989 = x;
double r183990 = exp(r183980);
double r183991 = r183989 / r183990;
double r183992 = 1.0;
double r183993 = r183980 + r183992;
double r183994 = r183991 / r183993;
double r183995 = r183988 + r183994;
return r183995;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.9 |
|---|---|
| Target | 13.3 |
| Herbie | 1.2 |
Initial program 13.9
Simplified13.3
rmApplied div-sub13.3
Applied associate--r-7.0
Taylor expanded around 0 1.2
Final simplification1.2
herbie shell --seed 2019304
(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))))))