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 r213544 = wj;
double r213545 = exp(r213544);
double r213546 = r213544 * r213545;
double r213547 = x;
double r213548 = r213546 - r213547;
double r213549 = r213545 + r213546;
double r213550 = r213548 / r213549;
double r213551 = r213544 - r213550;
return r213551;
}
double f(double wj, double x) {
double r213552 = x;
double r213553 = wj;
double r213554 = 1.0;
double r213555 = r213553 + r213554;
double r213556 = r213552 / r213555;
double r213557 = exp(r213553);
double r213558 = r213556 / r213557;
double r213559 = 4.0;
double r213560 = pow(r213553, r213559);
double r213561 = 3.0;
double r213562 = pow(r213553, r213561);
double r213563 = r213560 - r213562;
double r213564 = fma(r213553, r213553, r213563);
double r213565 = r213558 + r213564;
return r213565;
}




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))))))