wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot wj + x\right) - \left(wj + wj\right) \cdot x
double f(double wj, double x) {
double r9317314 = wj;
double r9317315 = exp(r9317314);
double r9317316 = r9317314 * r9317315;
double r9317317 = x;
double r9317318 = r9317316 - r9317317;
double r9317319 = r9317315 + r9317316;
double r9317320 = r9317318 / r9317319;
double r9317321 = r9317314 - r9317320;
return r9317321;
}
double f(double wj, double x) {
double r9317322 = wj;
double r9317323 = r9317322 * r9317322;
double r9317324 = x;
double r9317325 = r9317323 + r9317324;
double r9317326 = r9317322 + r9317322;
double r9317327 = r9317326 * r9317324;
double r9317328 = r9317325 - r9317327;
return r9317328;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.2 |
Initial program 13.8
Taylor expanded around 0 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2019164
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))