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 r241909 = wj;
double r241910 = exp(r241909);
double r241911 = r241909 * r241910;
double r241912 = x;
double r241913 = r241911 - r241912;
double r241914 = r241910 + r241911;
double r241915 = r241913 / r241914;
double r241916 = r241909 - r241915;
return r241916;
}
double f(double wj, double x) {
double r241917 = x;
double r241918 = wj;
double r241919 = 1.0;
double r241920 = r241918 + r241919;
double r241921 = r241917 / r241920;
double r241922 = exp(r241918);
double r241923 = r241921 / r241922;
double r241924 = 4.0;
double r241925 = pow(r241918, r241924);
double r241926 = 3.0;
double r241927 = pow(r241918, r241926);
double r241928 = r241925 - r241927;
double r241929 = fma(r241918, r241918, r241928);
double r241930 = r241923 + r241929;
return r241930;
}




Bits error versus wj




Bits error versus x
| Original | 14.0 |
|---|---|
| Target | 13.3 |
| Herbie | 1.2 |
Initial program 14.0
Simplified13.3
rmApplied associate--l+6.9
Taylor expanded around 0 1.2
Simplified1.2
Final simplification1.2
herbie shell --seed 2020083 +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))))))