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 r8769266 = wj;
double r8769267 = exp(r8769266);
double r8769268 = r8769266 * r8769267;
double r8769269 = x;
double r8769270 = r8769268 - r8769269;
double r8769271 = r8769267 + r8769268;
double r8769272 = r8769270 / r8769271;
double r8769273 = r8769266 - r8769272;
return r8769273;
}
double f(double wj, double x) {
double r8769274 = x;
double r8769275 = -2.0;
double r8769276 = r8769274 * r8769275;
double r8769277 = wj;
double r8769278 = fma(r8769277, r8769277, r8769274);
double r8769279 = fma(r8769276, r8769277, r8769278);
return r8769279;
}




Bits error versus wj




Bits error versus x
| Original | 13.9 |
|---|---|
| Target | 13.3 |
| Herbie | 2.2 |
Initial program 13.9
Taylor expanded around 0 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2019162 +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))))))