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 r3379226 = wj;
double r3379227 = exp(r3379226);
double r3379228 = r3379226 * r3379227;
double r3379229 = x;
double r3379230 = r3379228 - r3379229;
double r3379231 = r3379227 + r3379228;
double r3379232 = r3379230 / r3379231;
double r3379233 = r3379226 - r3379232;
return r3379233;
}
double f(double wj, double x) {
double r3379234 = wj;
double r3379235 = x;
double r3379236 = fma(r3379234, r3379234, r3379235);
double r3379237 = r3379234 + r3379234;
double r3379238 = r3379237 * r3379235;
double r3379239 = r3379236 - r3379238;
return r3379239;
}




Bits error versus wj




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