wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot x\right) \cdot -2 + \mathsf{fma}\left(wj, wj, x\right)double f(double wj, double x) {
double r9962547 = wj;
double r9962548 = exp(r9962547);
double r9962549 = r9962547 * r9962548;
double r9962550 = x;
double r9962551 = r9962549 - r9962550;
double r9962552 = r9962548 + r9962549;
double r9962553 = r9962551 / r9962552;
double r9962554 = r9962547 - r9962553;
return r9962554;
}
double f(double wj, double x) {
double r9962555 = wj;
double r9962556 = x;
double r9962557 = r9962555 * r9962556;
double r9962558 = -2.0;
double r9962559 = r9962557 * r9962558;
double r9962560 = fma(r9962555, r9962555, r9962556);
double r9962561 = r9962559 + r9962560;
return r9962561;
}




Bits error versus wj




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