wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(x \cdot wj, -2, \mathsf{fma}\left(wj, wj, x\right)\right)double f(double wj, double x) {
double r14554491 = wj;
double r14554492 = exp(r14554491);
double r14554493 = r14554491 * r14554492;
double r14554494 = x;
double r14554495 = r14554493 - r14554494;
double r14554496 = r14554492 + r14554493;
double r14554497 = r14554495 / r14554496;
double r14554498 = r14554491 - r14554497;
return r14554498;
}
double f(double wj, double x) {
double r14554499 = x;
double r14554500 = wj;
double r14554501 = r14554499 * r14554500;
double r14554502 = -2.0;
double r14554503 = fma(r14554500, r14554500, r14554499);
double r14554504 = fma(r14554501, r14554502, r14554503);
return r14554504;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.3 |
Initial program 13.4
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019174 +o rules:numerics
(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))))))