wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(\mathsf{fma}\left(wj, wj, {wj}^{4}\right) - {wj}^{3}\right) + \frac{\frac{x}{e^{wj}}}{1 + wj}double f(double wj, double x) {
double r161694 = wj;
double r161695 = exp(r161694);
double r161696 = r161694 * r161695;
double r161697 = x;
double r161698 = r161696 - r161697;
double r161699 = r161695 + r161696;
double r161700 = r161698 / r161699;
double r161701 = r161694 - r161700;
return r161701;
}
double f(double wj, double x) {
double r161702 = wj;
double r161703 = 4.0;
double r161704 = pow(r161702, r161703);
double r161705 = fma(r161702, r161702, r161704);
double r161706 = 3.0;
double r161707 = pow(r161702, r161706);
double r161708 = r161705 - r161707;
double r161709 = x;
double r161710 = exp(r161702);
double r161711 = r161709 / r161710;
double r161712 = 1.0;
double r161713 = r161712 + r161702;
double r161714 = r161711 / r161713;
double r161715 = r161708 + r161714;
return r161715;
}




Bits error versus wj




Bits error versus x
| Original | 14.0 |
|---|---|
| Target | 13.3 |
| Herbie | 1.3 |
Initial program 14.0
Simplified13.3
rmApplied div-sub13.3
Applied associate--r-7.2
Taylor expanded around 0 1.3
Simplified1.3
Final simplification1.3
herbie shell --seed 2019306 +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))))))