wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x - \left(wj + wj\right) \cdot x\right)double f(double wj, double x) {
double r6995929 = wj;
double r6995930 = exp(r6995929);
double r6995931 = r6995929 * r6995930;
double r6995932 = x;
double r6995933 = r6995931 - r6995932;
double r6995934 = r6995930 + r6995931;
double r6995935 = r6995933 / r6995934;
double r6995936 = r6995929 - r6995935;
return r6995936;
}
double f(double wj, double x) {
double r6995937 = wj;
double r6995938 = x;
double r6995939 = r6995937 + r6995937;
double r6995940 = r6995939 * r6995938;
double r6995941 = r6995938 - r6995940;
double r6995942 = fma(r6995937, r6995937, r6995941);
return r6995942;
}




Bits error versus wj




Bits error versus x
| Original | 13.7 |
|---|---|
| Target | 13.1 |
| Herbie | 2.1 |
Initial program 13.7
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019144 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))