wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj \cdot x, -2, \mathsf{fma}\left(wj, wj, x\right)\right)double f(double wj, double x) {
double r363440 = wj;
double r363441 = exp(r363440);
double r363442 = r363440 * r363441;
double r363443 = x;
double r363444 = r363442 - r363443;
double r363445 = r363441 + r363442;
double r363446 = r363444 / r363445;
double r363447 = r363440 - r363446;
return r363447;
}
double f(double wj, double x) {
double r363448 = wj;
double r363449 = x;
double r363450 = r363448 * r363449;
double r363451 = -2.0;
double r363452 = fma(r363448, r363448, r363449);
double r363453 = fma(r363450, r363451, r363452);
return r363453;
}




Bits error versus wj




Bits error versus x
| Original | 13.1 |
|---|---|
| Target | 12.4 |
| Herbie | 2.3 |
Initial program 13.1
Simplified12.4
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019350 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))