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 r187309 = wj;
double r187310 = exp(r187309);
double r187311 = r187309 * r187310;
double r187312 = x;
double r187313 = r187311 - r187312;
double r187314 = r187310 + r187311;
double r187315 = r187313 / r187314;
double r187316 = r187309 - r187315;
return r187316;
}
double f(double wj, double x) {
double r187317 = x;
double r187318 = wj;
double r187319 = 2.0;
double r187320 = pow(r187318, r187319);
double r187321 = r187317 + r187320;
double r187322 = r187318 * r187317;
double r187323 = r187319 * r187322;
double r187324 = r187321 - r187323;
return r187324;
}




Bits error versus wj




Bits error versus x
Results
| Original | 14.3 |
|---|---|
| Target | 13.6 |
| Herbie | 2.2 |
Initial program 14.3
Simplified13.6
Taylor expanded around 0 2.2
Final simplification2.2
herbie shell --seed 2020036 +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))))))