wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, \left(wj \cdot wj - wj\right) \cdot \left(wj \cdot wj\right)\right) + \frac{x}{wj \cdot e^{wj} + e^{wj}}double f(double wj, double x) {
double r7002937 = wj;
double r7002938 = exp(r7002937);
double r7002939 = r7002937 * r7002938;
double r7002940 = x;
double r7002941 = r7002939 - r7002940;
double r7002942 = r7002938 + r7002939;
double r7002943 = r7002941 / r7002942;
double r7002944 = r7002937 - r7002943;
return r7002944;
}
double f(double wj, double x) {
double r7002945 = wj;
double r7002946 = r7002945 * r7002945;
double r7002947 = r7002946 - r7002945;
double r7002948 = r7002947 * r7002946;
double r7002949 = fma(r7002945, r7002945, r7002948);
double r7002950 = x;
double r7002951 = exp(r7002945);
double r7002952 = r7002945 * r7002951;
double r7002953 = r7002952 + r7002951;
double r7002954 = r7002950 / r7002953;
double r7002955 = r7002949 + r7002954;
return r7002955;
}




Bits error versus wj




Bits error versus x
| Original | 13.7 |
|---|---|
| Target | 13.1 |
| Herbie | 1.1 |
Initial program 13.7
rmApplied div-sub13.7
Applied associate--r-7.7
Taylor expanded around 0 1.1
Simplified1.1
rmApplied fma-def1.1
Final simplification1.1
herbie shell --seed 2019152 +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))))))