wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)double f(double wj, double x) {
double r198149 = wj;
double r198150 = exp(r198149);
double r198151 = r198149 * r198150;
double r198152 = x;
double r198153 = r198151 - r198152;
double r198154 = r198150 + r198151;
double r198155 = r198153 / r198154;
double r198156 = r198149 - r198155;
return r198156;
}
double f(double wj, double x) {
double r198157 = x;
double r198158 = wj;
double r198159 = 2.0;
double r198160 = pow(r198158, r198159);
double r198161 = r198157 + r198160;
double r198162 = r198158 * r198157;
double r198163 = r198159 * r198162;
double r198164 = r198161 - r198163;
return r198164;
}




Bits error versus wj




Bits error versus x
Results
| Original | 14.3 |
|---|---|
| Target | 13.6 |
| Herbie | 2.2 |
Initial program 14.3
Simplified13.6
Taylor expanded around 0 2.2
Final simplification2.2
herbie shell --seed 2020036 +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))))))