wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj \cdot \left(wj \cdot wj\right), wj, wj \cdot wj - wj \cdot \left(wj \cdot wj\right)\right) + \frac{x}{wj \cdot e^{wj} + e^{wj}}double f(double wj, double x) {
double r6334994 = wj;
double r6334995 = exp(r6334994);
double r6334996 = r6334994 * r6334995;
double r6334997 = x;
double r6334998 = r6334996 - r6334997;
double r6334999 = r6334995 + r6334996;
double r6335000 = r6334998 / r6334999;
double r6335001 = r6334994 - r6335000;
return r6335001;
}
double f(double wj, double x) {
double r6335002 = wj;
double r6335003 = r6335002 * r6335002;
double r6335004 = r6335002 * r6335003;
double r6335005 = r6335003 - r6335004;
double r6335006 = fma(r6335004, r6335002, r6335005);
double r6335007 = x;
double r6335008 = exp(r6335002);
double r6335009 = r6335002 * r6335008;
double r6335010 = r6335009 + r6335008;
double r6335011 = r6335007 / r6335010;
double r6335012 = r6335006 + r6335011;
return r6335012;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 1.0 |
Initial program 13.8
rmApplied div-sub13.8
Applied associate--r-7.7
Taylor expanded around 0 1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2019192 +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))))))