wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot x\right) \cdot -2 + \mathsf{fma}\left(wj, wj, x\right)double f(double wj, double x) {
double r9090944 = wj;
double r9090945 = exp(r9090944);
double r9090946 = r9090944 * r9090945;
double r9090947 = x;
double r9090948 = r9090946 - r9090947;
double r9090949 = r9090945 + r9090946;
double r9090950 = r9090948 / r9090949;
double r9090951 = r9090944 - r9090950;
return r9090951;
}
double f(double wj, double x) {
double r9090952 = wj;
double r9090953 = x;
double r9090954 = r9090952 * r9090953;
double r9090955 = -2.0;
double r9090956 = r9090954 * r9090955;
double r9090957 = fma(r9090952, r9090952, r9090953);
double r9090958 = r9090956 + r9090957;
return r9090958;
}




Bits error versus wj




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