wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - \left(2 \cdot x\right) \cdot wjdouble f(double wj, double x) {
double r380880 = wj;
double r380881 = exp(r380880);
double r380882 = r380880 * r380881;
double r380883 = x;
double r380884 = r380882 - r380883;
double r380885 = r380881 + r380882;
double r380886 = r380884 / r380885;
double r380887 = r380880 - r380886;
return r380887;
}
double f(double wj, double x) {
double r380888 = wj;
double r380889 = x;
double r380890 = fma(r380888, r380888, r380889);
double r380891 = 2.0;
double r380892 = r380891 * r380889;
double r380893 = r380892 * r380888;
double r380894 = r380890 - r380893;
return r380894;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.3 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019174 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))