wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x - 2 \cdot \left(wj \cdot x\right)\right)double f(double wj, double x) {
double r249941 = wj;
double r249942 = exp(r249941);
double r249943 = r249941 * r249942;
double r249944 = x;
double r249945 = r249943 - r249944;
double r249946 = r249942 + r249943;
double r249947 = r249945 / r249946;
double r249948 = r249941 - r249947;
return r249948;
}
double f(double wj, double x) {
double r249949 = wj;
double r249950 = x;
double r249951 = 2.0;
double r249952 = r249949 * r249950;
double r249953 = r249951 * r249952;
double r249954 = r249950 - r249953;
double r249955 = fma(r249949, r249949, r249954);
return r249955;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.7 |
| Herbie | 2.0 |
Initial program 13.4
Taylor expanded around 0 2.0
Simplified2.0
Final simplification2.0
herbie shell --seed 2020024 +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))))))