wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(x \cdot -2, wj, \mathsf{fma}\left(wj, wj, x\right)\right)double f(double wj, double x) {
double r7581354 = wj;
double r7581355 = exp(r7581354);
double r7581356 = r7581354 * r7581355;
double r7581357 = x;
double r7581358 = r7581356 - r7581357;
double r7581359 = r7581355 + r7581356;
double r7581360 = r7581358 / r7581359;
double r7581361 = r7581354 - r7581360;
return r7581361;
}
double f(double wj, double x) {
double r7581362 = x;
double r7581363 = -2.0;
double r7581364 = r7581362 * r7581363;
double r7581365 = wj;
double r7581366 = fma(r7581365, r7581365, r7581362);
double r7581367 = fma(r7581364, r7581365, r7581366);
return r7581367;
}




Bits error versus wj




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