wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{e^{wj}}}{{wj}^{3} + 1} \cdot \left(1 + \left(wj \cdot wj - wj\right)\right) + \left(\mathsf{fma}\left(wj, wj, {wj}^{4}\right) - {wj}^{3}\right)double f(double wj, double x) {
double r186985 = wj;
double r186986 = exp(r186985);
double r186987 = r186985 * r186986;
double r186988 = x;
double r186989 = r186987 - r186988;
double r186990 = r186986 + r186987;
double r186991 = r186989 / r186990;
double r186992 = r186985 - r186991;
return r186992;
}
double f(double wj, double x) {
double r186993 = x;
double r186994 = wj;
double r186995 = exp(r186994);
double r186996 = r186993 / r186995;
double r186997 = 3.0;
double r186998 = pow(r186994, r186997);
double r186999 = 1.0;
double r187000 = r186998 + r186999;
double r187001 = r186996 / r187000;
double r187002 = r186994 * r186994;
double r187003 = r187002 - r186994;
double r187004 = r186999 + r187003;
double r187005 = r187001 * r187004;
double r187006 = 4.0;
double r187007 = pow(r186994, r187006);
double r187008 = fma(r186994, r186994, r187007);
double r187009 = r187008 - r186998;
double r187010 = r187005 + r187009;
return r187010;
}




Bits error versus wj




Bits error versus x
| Original | 13.6 |
|---|---|
| Target | 12.9 |
| Herbie | 1.1 |
Initial program 13.6
Simplified12.9
rmApplied div-sub12.9
Applied associate--r-6.8
Simplified6.8
Taylor expanded around 0 1.1
Simplified1.1
rmApplied flip3-+1.1
Applied associate-/r/1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2019212 +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))))))