wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{wj + 1}}{e^{wj}} + \mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right)double f(double wj, double x) {
double r152449 = wj;
double r152450 = exp(r152449);
double r152451 = r152449 * r152450;
double r152452 = x;
double r152453 = r152451 - r152452;
double r152454 = r152450 + r152451;
double r152455 = r152453 / r152454;
double r152456 = r152449 - r152455;
return r152456;
}
double f(double wj, double x) {
double r152457 = x;
double r152458 = wj;
double r152459 = 1.0;
double r152460 = r152458 + r152459;
double r152461 = r152457 / r152460;
double r152462 = exp(r152458);
double r152463 = r152461 / r152462;
double r152464 = 4.0;
double r152465 = pow(r152458, r152464);
double r152466 = 3.0;
double r152467 = pow(r152458, r152466);
double r152468 = r152465 - r152467;
double r152469 = fma(r152458, r152458, r152468);
double r152470 = r152463 + r152469;
return r152470;
}




Bits error versus wj




Bits error versus x
| Original | 13.5 |
|---|---|
| Target | 12.9 |
| Herbie | 1.1 |
Initial program 13.5
Simplified12.9
rmApplied associate--l+7.0
Taylor expanded around 0 1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2020018 +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))))))