wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot wj + \left(wj \cdot wj - wj\right) \cdot \left(wj \cdot wj\right)\right) + \frac{x}{wj \cdot e^{wj} + e^{wj}}double f(double wj, double x) {
double r10629756 = wj;
double r10629757 = exp(r10629756);
double r10629758 = r10629756 * r10629757;
double r10629759 = x;
double r10629760 = r10629758 - r10629759;
double r10629761 = r10629757 + r10629758;
double r10629762 = r10629760 / r10629761;
double r10629763 = r10629756 - r10629762;
return r10629763;
}
double f(double wj, double x) {
double r10629764 = wj;
double r10629765 = r10629764 * r10629764;
double r10629766 = r10629765 - r10629764;
double r10629767 = r10629766 * r10629765;
double r10629768 = r10629765 + r10629767;
double r10629769 = x;
double r10629770 = exp(r10629764);
double r10629771 = r10629764 * r10629770;
double r10629772 = r10629771 + r10629770;
double r10629773 = r10629769 / r10629772;
double r10629774 = r10629768 + r10629773;
return r10629774;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.2 |
|---|---|
| Target | 12.5 |
| Herbie | 1.1 |
Initial program 13.2
rmApplied add-cube-cbrt13.3
Applied associate-*l*13.3
rmApplied div-sub13.3
Applied associate--r-12.5
Simplified6.6
Taylor expanded around 0 1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2019149
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))