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 r182249 = wj;
double r182250 = exp(r182249);
double r182251 = r182249 * r182250;
double r182252 = x;
double r182253 = r182251 - r182252;
double r182254 = r182250 + r182251;
double r182255 = r182253 / r182254;
double r182256 = r182249 - r182255;
return r182256;
}
double f(double wj, double x) {
double r182257 = x;
double r182258 = wj;
double r182259 = 2.0;
double r182260 = pow(r182258, r182259);
double r182261 = r182257 + r182260;
double r182262 = r182258 * r182257;
double r182263 = r182259 * r182262;
double r182264 = r182261 - r182263;
return r182264;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.2 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.2
Final simplification2.2
herbie shell --seed 2020046
(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))))))