wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - \left(wj + wj\right) \cdot xdouble f(double wj, double x) {
double r3410726 = wj;
double r3410727 = exp(r3410726);
double r3410728 = r3410726 * r3410727;
double r3410729 = x;
double r3410730 = r3410728 - r3410729;
double r3410731 = r3410727 + r3410728;
double r3410732 = r3410730 / r3410731;
double r3410733 = r3410726 - r3410732;
return r3410733;
}
double f(double wj, double x) {
double r3410734 = wj;
double r3410735 = x;
double r3410736 = fma(r3410734, r3410734, r3410735);
double r3410737 = r3410734 + r3410734;
double r3410738 = r3410737 * r3410735;
double r3410739 = r3410736 - r3410738;
return r3410739;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.0 |
Initial program 13.8
Taylor expanded around 0 2.0
Simplified2.0
Final simplification2.0
herbie shell --seed 2019154 +o rules:numerics
(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))))))