wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{e^{wj}}}{1 + wj} + \mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right)double f(double wj, double x) {
double r130943 = wj;
double r130944 = exp(r130943);
double r130945 = r130943 * r130944;
double r130946 = x;
double r130947 = r130945 - r130946;
double r130948 = r130944 + r130945;
double r130949 = r130947 / r130948;
double r130950 = r130943 - r130949;
return r130950;
}
double f(double wj, double x) {
double r130951 = x;
double r130952 = wj;
double r130953 = exp(r130952);
double r130954 = r130951 / r130953;
double r130955 = 1.0;
double r130956 = r130955 + r130952;
double r130957 = r130954 / r130956;
double r130958 = 4.0;
double r130959 = pow(r130952, r130958);
double r130960 = 3.0;
double r130961 = pow(r130952, r130960);
double r130962 = r130959 - r130961;
double r130963 = fma(r130952, r130952, r130962);
double r130964 = r130957 + r130963;
return r130964;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 1.1 |
Initial program 13.4
Simplified12.8
rmApplied div-sub12.8
Applied associate--r-6.6
Taylor expanded around 0 1.1
Simplified1.1
rmApplied *-un-lft-identity1.1
Applied *-un-lft-identity1.1
Applied distribute-lft-out--1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2019323 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))