wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{x}{e^{wj} + e^{wj} \cdot wj} + \mathsf{fma}\left(wj \cdot wj, wj \cdot wj, \mathsf{fma}\left(wj, wj, wj \cdot \left(\left(-wj\right) \cdot wj\right)\right)\right)double f(double wj, double x) {
double r8319861 = wj;
double r8319862 = exp(r8319861);
double r8319863 = r8319861 * r8319862;
double r8319864 = x;
double r8319865 = r8319863 - r8319864;
double r8319866 = r8319862 + r8319863;
double r8319867 = r8319865 / r8319866;
double r8319868 = r8319861 - r8319867;
return r8319868;
}
double f(double wj, double x) {
double r8319869 = x;
double r8319870 = wj;
double r8319871 = exp(r8319870);
double r8319872 = r8319871 * r8319870;
double r8319873 = r8319871 + r8319872;
double r8319874 = r8319869 / r8319873;
double r8319875 = r8319870 * r8319870;
double r8319876 = -r8319870;
double r8319877 = r8319876 * r8319870;
double r8319878 = r8319870 * r8319877;
double r8319879 = fma(r8319870, r8319870, r8319878);
double r8319880 = fma(r8319875, r8319875, r8319879);
double r8319881 = r8319874 + r8319880;
return r8319881;
}




Bits error versus wj




Bits error versus x
| Original | 13.7 |
|---|---|
| Target | 13.1 |
| Herbie | 1.0 |
Initial program 13.7
rmApplied div-sub13.7
Applied associate--r-7.3
Taylor expanded around 0 1.0
Simplified1.0
rmApplied fma-neg1.0
Final simplification1.0
herbie shell --seed 2019170 +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))))))