wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{wj + 1}}{e^{wj}} + \mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right)double f(double wj, double x) {
double r209685 = wj;
double r209686 = exp(r209685);
double r209687 = r209685 * r209686;
double r209688 = x;
double r209689 = r209687 - r209688;
double r209690 = r209686 + r209687;
double r209691 = r209689 / r209690;
double r209692 = r209685 - r209691;
return r209692;
}
double f(double wj, double x) {
double r209693 = x;
double r209694 = wj;
double r209695 = 1.0;
double r209696 = r209694 + r209695;
double r209697 = r209693 / r209696;
double r209698 = exp(r209694);
double r209699 = r209697 / r209698;
double r209700 = 4.0;
double r209701 = pow(r209694, r209700);
double r209702 = 3.0;
double r209703 = pow(r209694, r209702);
double r209704 = r209701 - r209703;
double r209705 = fma(r209694, r209694, r209704);
double r209706 = r209699 + r209705;
return r209706;
}




Bits error versus wj




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