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 r231526 = wj;
double r231527 = exp(r231526);
double r231528 = r231526 * r231527;
double r231529 = x;
double r231530 = r231528 - r231529;
double r231531 = r231527 + r231528;
double r231532 = r231530 / r231531;
double r231533 = r231526 - r231532;
return r231533;
}
double f(double wj, double x) {
double r231534 = wj;
double r231535 = x;
double r231536 = fma(r231534, r231534, r231535);
double r231537 = 2.0;
double r231538 = r231534 * r231535;
double r231539 = r231537 * r231538;
double r231540 = r231536 - r231539;
return r231540;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.2 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.2
Taylor expanded around 0 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2020046 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))