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 r176694 = wj;
double r176695 = exp(r176694);
double r176696 = r176694 * r176695;
double r176697 = x;
double r176698 = r176696 - r176697;
double r176699 = r176695 + r176696;
double r176700 = r176698 / r176699;
double r176701 = r176694 - r176700;
return r176701;
}
double f(double wj, double x) {
double r176702 = x;
double r176703 = wj;
double r176704 = 1.0;
double r176705 = r176703 + r176704;
double r176706 = r176702 / r176705;
double r176707 = exp(r176703);
double r176708 = r176706 / r176707;
double r176709 = 4.0;
double r176710 = pow(r176703, r176709);
double r176711 = 3.0;
double r176712 = pow(r176703, r176711);
double r176713 = r176710 - r176712;
double r176714 = fma(r176703, r176703, r176713);
double r176715 = r176708 + r176714;
return r176715;
}




Bits error versus wj




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