wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - 2 \cdot \left(wj \cdot x\right)double f(double wj, double x) {
double r6325292 = wj;
double r6325293 = exp(r6325292);
double r6325294 = r6325292 * r6325293;
double r6325295 = x;
double r6325296 = r6325294 - r6325295;
double r6325297 = r6325293 + r6325294;
double r6325298 = r6325296 / r6325297;
double r6325299 = r6325292 - r6325298;
return r6325299;
}
double f(double wj, double x) {
double r6325300 = wj;
double r6325301 = x;
double r6325302 = fma(r6325300, r6325300, r6325301);
double r6325303 = 2.0;
double r6325304 = r6325300 * r6325301;
double r6325305 = r6325303 * r6325304;
double r6325306 = r6325302 - r6325305;
return r6325306;
}




Bits error versus wj




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