wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj \cdot x, -2, \mathsf{fma}\left(wj, wj, x\right)\right)double f(double wj, double x) {
double r8907739 = wj;
double r8907740 = exp(r8907739);
double r8907741 = r8907739 * r8907740;
double r8907742 = x;
double r8907743 = r8907741 - r8907742;
double r8907744 = r8907740 + r8907741;
double r8907745 = r8907743 / r8907744;
double r8907746 = r8907739 - r8907745;
return r8907746;
}
double f(double wj, double x) {
double r8907747 = wj;
double r8907748 = x;
double r8907749 = r8907747 * r8907748;
double r8907750 = -2.0;
double r8907751 = fma(r8907747, r8907747, r8907748);
double r8907752 = fma(r8907749, r8907750, r8907751);
return r8907752;
}




Bits error versus wj




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