wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right) + \frac{\frac{x}{e^{wj}}}{1 + wj}double f(double wj, double x) {
double r122132 = wj;
double r122133 = exp(r122132);
double r122134 = r122132 * r122133;
double r122135 = x;
double r122136 = r122134 - r122135;
double r122137 = r122133 + r122134;
double r122138 = r122136 / r122137;
double r122139 = r122132 - r122138;
return r122139;
}
double f(double wj, double x) {
double r122140 = wj;
double r122141 = 4.0;
double r122142 = pow(r122140, r122141);
double r122143 = 3.0;
double r122144 = pow(r122140, r122143);
double r122145 = r122142 - r122144;
double r122146 = fma(r122140, r122140, r122145);
double r122147 = x;
double r122148 = exp(r122140);
double r122149 = r122147 / r122148;
double r122150 = 1.0;
double r122151 = r122150 + r122140;
double r122152 = r122149 / r122151;
double r122153 = r122146 + r122152;
return r122153;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 1.1 |
Initial program 13.4
Simplified12.8
rmApplied div-sub12.8
Applied associate--r-6.6
Taylor expanded around 0 1.1
Simplified1.1
rmApplied add-cube-cbrt1.1
Applied unpow-prod-down1.1
Applied add-sqr-sqrt1.1
Applied prod-diff1.1
Simplified1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2019323 +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))))))