wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - \left(wj + wj\right) \cdot xdouble f(double wj, double x) {
double r3838314 = wj;
double r3838315 = exp(r3838314);
double r3838316 = r3838314 * r3838315;
double r3838317 = x;
double r3838318 = r3838316 - r3838317;
double r3838319 = r3838315 + r3838316;
double r3838320 = r3838318 / r3838319;
double r3838321 = r3838314 - r3838320;
return r3838321;
}
double f(double wj, double x) {
double r3838322 = wj;
double r3838323 = x;
double r3838324 = fma(r3838322, r3838322, r3838323);
double r3838325 = r3838322 + r3838322;
double r3838326 = r3838325 * r3838323;
double r3838327 = r3838324 - r3838326;
return r3838327;
}




Bits error versus wj




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