wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{e^{wj}}}{1 + wj} - \left({wj}^{3} - \mathsf{fma}\left(wj, wj, {wj}^{4}\right)\right)double f(double wj, double x) {
double r283770 = wj;
double r283771 = exp(r283770);
double r283772 = r283770 * r283771;
double r283773 = x;
double r283774 = r283772 - r283773;
double r283775 = r283771 + r283772;
double r283776 = r283774 / r283775;
double r283777 = r283770 - r283776;
return r283777;
}
double f(double wj, double x) {
double r283778 = x;
double r283779 = wj;
double r283780 = exp(r283779);
double r283781 = r283778 / r283780;
double r283782 = 1.0;
double r283783 = r283782 + r283779;
double r283784 = r283781 / r283783;
double r283785 = 3.0;
double r283786 = pow(r283779, r283785);
double r283787 = 4.0;
double r283788 = pow(r283779, r283787);
double r283789 = fma(r283779, r283779, r283788);
double r283790 = r283786 - r283789;
double r283791 = r283784 - r283790;
return r283791;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.3 |
| Herbie | 1.0 |
Initial program 13.8
Simplified13.3
rmApplied div-sub13.3
Applied associate-+l-6.9
Taylor expanded around 0 1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2020047 +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))))))