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 r250531 = wj;
double r250532 = exp(r250531);
double r250533 = r250531 * r250532;
double r250534 = x;
double r250535 = r250533 - r250534;
double r250536 = r250532 + r250533;
double r250537 = r250535 / r250536;
double r250538 = r250531 - r250537;
return r250538;
}
double f(double wj, double x) {
double r250539 = x;
double r250540 = wj;
double r250541 = 1.0;
double r250542 = r250540 + r250541;
double r250543 = r250539 / r250542;
double r250544 = exp(r250540);
double r250545 = r250543 / r250544;
double r250546 = 4.0;
double r250547 = pow(r250540, r250546);
double r250548 = 3.0;
double r250549 = pow(r250540, r250548);
double r250550 = r250547 - r250549;
double r250551 = fma(r250540, r250540, r250550);
double r250552 = r250545 + r250551;
return r250552;
}




Bits error versus wj




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