wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}wj \cdot \left(wj - 2 \cdot x\right) + x
double f(double wj, double x) {
double r144806 = wj;
double r144807 = exp(r144806);
double r144808 = r144806 * r144807;
double r144809 = x;
double r144810 = r144808 - r144809;
double r144811 = r144807 + r144808;
double r144812 = r144810 / r144811;
double r144813 = r144806 - r144812;
return r144813;
}
double f(double wj, double x) {
double r144814 = wj;
double r144815 = 2.0;
double r144816 = x;
double r144817 = r144815 * r144816;
double r144818 = r144814 - r144817;
double r144819 = r144814 * r144818;
double r144820 = r144819 + r144816;
return r144820;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.2 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2020046
(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))))))