wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(\left(\mathsf{fma}\left(x, -2, wj\right)\right), wj, x\right)double f(double wj, double x) {
double r57385052 = wj;
double r57385053 = exp(r57385052);
double r57385054 = r57385052 * r57385053;
double r57385055 = x;
double r57385056 = r57385054 - r57385055;
double r57385057 = r57385053 + r57385054;
double r57385058 = r57385056 / r57385057;
double r57385059 = r57385052 - r57385058;
return r57385059;
}
double f(double wj, double x) {
double r57385060 = x;
double r57385061 = -2.0;
double r57385062 = wj;
double r57385063 = fma(r57385060, r57385061, r57385062);
double r57385064 = fma(r57385063, r57385062, r57385060);
return r57385064;
}




Bits error versus wj




Bits error versus x
| Original | 14.1 |
|---|---|
| Target | 13.5 |
| Herbie | 2.3 |
Initial program 14.1
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019125 +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))))))