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 r6562208 = wj;
double r6562209 = exp(r6562208);
double r6562210 = r6562208 * r6562209;
double r6562211 = x;
double r6562212 = r6562210 - r6562211;
double r6562213 = r6562209 + r6562210;
double r6562214 = r6562212 / r6562213;
double r6562215 = r6562208 - r6562214;
return r6562215;
}
double f(double wj, double x) {
double r6562216 = wj;
double r6562217 = x;
double r6562218 = r6562216 * r6562217;
double r6562219 = -2.0;
double r6562220 = fma(r6562216, r6562216, r6562217);
double r6562221 = fma(r6562218, r6562219, r6562220);
return r6562221;
}




Bits error versus wj




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