wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right) + \frac{\frac{x}{e^{wj}}}{1 + wj}double f(double wj, double x) {
double r164762 = wj;
double r164763 = exp(r164762);
double r164764 = r164762 * r164763;
double r164765 = x;
double r164766 = r164764 - r164765;
double r164767 = r164763 + r164764;
double r164768 = r164766 / r164767;
double r164769 = r164762 - r164768;
return r164769;
}
double f(double wj, double x) {
double r164770 = wj;
double r164771 = 4.0;
double r164772 = pow(r164770, r164771);
double r164773 = 3.0;
double r164774 = pow(r164770, r164773);
double r164775 = r164772 - r164774;
double r164776 = fma(r164770, r164770, r164775);
double r164777 = x;
double r164778 = exp(r164770);
double r164779 = r164777 / r164778;
double r164780 = 1.0;
double r164781 = r164780 + r164770;
double r164782 = r164779 / r164781;
double r164783 = r164776 + r164782;
return r164783;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 1.1 |
Initial program 13.4
Simplified12.8
rmApplied div-sub12.8
Applied associate--r-6.6
Taylor expanded around 0 1.1
Simplified1.1
Taylor expanded around 0 1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2019323 +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))))))