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 r6796518 = wj;
double r6796519 = exp(r6796518);
double r6796520 = r6796518 * r6796519;
double r6796521 = x;
double r6796522 = r6796520 - r6796521;
double r6796523 = r6796519 + r6796520;
double r6796524 = r6796522 / r6796523;
double r6796525 = r6796518 - r6796524;
return r6796525;
}
double f(double wj, double x) {
double r6796526 = wj;
double r6796527 = r6796526 * r6796526;
double r6796528 = x;
double r6796529 = r6796527 + r6796528;
double r6796530 = r6796526 + r6796526;
double r6796531 = r6796530 * r6796528;
double r6796532 = r6796529 - r6796531;
return r6796532;
}




Bits error versus wj




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