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 r3958627 = wj;
double r3958628 = exp(r3958627);
double r3958629 = r3958627 * r3958628;
double r3958630 = x;
double r3958631 = r3958629 - r3958630;
double r3958632 = r3958628 + r3958629;
double r3958633 = r3958631 / r3958632;
double r3958634 = r3958627 - r3958633;
return r3958634;
}
double f(double wj, double x) {
double r3958635 = wj;
double r3958636 = x;
double r3958637 = fma(r3958635, r3958635, r3958636);
double r3958638 = r3958635 + r3958635;
double r3958639 = r3958638 * r3958636;
double r3958640 = r3958637 - r3958639;
return r3958640;
}




Bits error versus wj




Bits error versus x
| Original | 14.0 |
|---|---|
| Target | 13.3 |
| Herbie | 2.1 |
Initial program 14.0
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019153 +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))))))