wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(\mathsf{fma}\left(wj, wj, {wj}^{4}\right) - {wj}^{3}\right) + \frac{\frac{x}{e^{wj}}}{1 + wj}double f(double wj, double x) {
double r208055 = wj;
double r208056 = exp(r208055);
double r208057 = r208055 * r208056;
double r208058 = x;
double r208059 = r208057 - r208058;
double r208060 = r208056 + r208057;
double r208061 = r208059 / r208060;
double r208062 = r208055 - r208061;
return r208062;
}
double f(double wj, double x) {
double r208063 = wj;
double r208064 = 4.0;
double r208065 = pow(r208063, r208064);
double r208066 = fma(r208063, r208063, r208065);
double r208067 = 3.0;
double r208068 = pow(r208063, r208067);
double r208069 = r208066 - r208068;
double r208070 = x;
double r208071 = exp(r208063);
double r208072 = r208070 / r208071;
double r208073 = 1.0;
double r208074 = r208073 + r208063;
double r208075 = r208072 / r208074;
double r208076 = r208069 + r208075;
return r208076;
}




Bits error versus wj




Bits error versus x
| Original | 13.6 |
|---|---|
| Target | 13.1 |
| Herbie | 1.0 |
Initial program 13.6
Simplified13.1
rmApplied div-sub13.1
Applied associate--r-7.2
Simplified7.2
Taylor expanded around 0 1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2019209 +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))))))