wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(\left(\mathsf{fma}\left(x, -2, wj\right)\right), wj, x\right)double f(double wj, double x) {
double r51946488 = wj;
double r51946489 = exp(r51946488);
double r51946490 = r51946488 * r51946489;
double r51946491 = x;
double r51946492 = r51946490 - r51946491;
double r51946493 = r51946489 + r51946490;
double r51946494 = r51946492 / r51946493;
double r51946495 = r51946488 - r51946494;
return r51946495;
}
double f(double wj, double x) {
double r51946496 = x;
double r51946497 = -2.0;
double r51946498 = wj;
double r51946499 = fma(r51946496, r51946497, r51946498);
double r51946500 = fma(r51946499, r51946498, r51946496);
return r51946500;
}




Bits error versus wj




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