wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - x \cdot \left(2 \cdot wj\right)double f(double wj, double x) {
double r8350973 = wj;
double r8350974 = exp(r8350973);
double r8350975 = r8350973 * r8350974;
double r8350976 = x;
double r8350977 = r8350975 - r8350976;
double r8350978 = r8350974 + r8350975;
double r8350979 = r8350977 / r8350978;
double r8350980 = r8350973 - r8350979;
return r8350980;
}
double f(double wj, double x) {
double r8350981 = wj;
double r8350982 = x;
double r8350983 = fma(r8350981, r8350981, r8350982);
double r8350984 = 2.0;
double r8350985 = r8350984 * r8350981;
double r8350986 = r8350982 * r8350985;
double r8350987 = r8350983 - r8350986;
return r8350987;
}




Bits error versus wj




Bits error versus x
| Original | 13.5 |
|---|---|
| Target | 12.8 |
| Herbie | 2.1 |
Initial program 13.5
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019134 +o rules:numerics
(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))))))