wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(\left(\left({wj}^{2} + 1\right) - wj\right) \cdot \frac{x}{e^{wj} \cdot \left(1 + {wj}^{3}\right)} + \left({wj}^{2} - {wj}^{3}\right)\right) + {wj}^{4}double f(double wj, double x) {
double r111234 = wj;
double r111235 = exp(r111234);
double r111236 = r111234 * r111235;
double r111237 = x;
double r111238 = r111236 - r111237;
double r111239 = r111235 + r111236;
double r111240 = r111238 / r111239;
double r111241 = r111234 - r111240;
return r111241;
}
double f(double wj, double x) {
double r111242 = wj;
double r111243 = 2.0;
double r111244 = pow(r111242, r111243);
double r111245 = 1.0;
double r111246 = r111244 + r111245;
double r111247 = r111246 - r111242;
double r111248 = x;
double r111249 = exp(r111242);
double r111250 = 3.0;
double r111251 = pow(r111242, r111250);
double r111252 = r111245 + r111251;
double r111253 = r111249 * r111252;
double r111254 = r111248 / r111253;
double r111255 = r111247 * r111254;
double r111256 = r111244 - r111251;
double r111257 = r111255 + r111256;
double r111258 = 4.0;
double r111259 = pow(r111242, r111258);
double r111260 = r111257 + r111259;
return r111260;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.5 |
|---|---|
| Target | 13.0 |
| Herbie | 0.9 |
Initial program 13.5
Simplified13.0
rmApplied associate--l+7.0
Taylor expanded around 0 0.9
rmApplied flip3-+0.9
Applied associate-/r/0.9
Applied associate-/l*0.9
Simplified0.9
Final simplification0.9
herbie shell --seed 2019291
(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))))))