wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)double f(double wj, double x) {
double r882 = wj;
double r883 = exp(r882);
double r884 = r882 * r883;
double r885 = x;
double r886 = r884 - r885;
double r887 = r883 + r884;
double r888 = r886 / r887;
double r889 = r882 - r888;
return r889;
}
double f(double wj, double x) {
double r890 = x;
double r891 = wj;
double r892 = 2.0;
double r893 = pow(r891, r892);
double r894 = r890 + r893;
double r895 = r891 * r890;
double r896 = r892 * r895;
double r897 = r894 - r896;
return r897;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.9 |
|---|---|
| Target | 13.2 |
| Herbie | 2.2 |
Initial program 13.9
Simplified13.2
Taylor expanded around 0 2.2
Final simplification2.2
herbie shell --seed 2020025
(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))))))