wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}wj \cdot wj + \left(x - \left(x \cdot 2\right) \cdot wj\right)
double f(double wj, double x) {
double r184115 = wj;
double r184116 = exp(r184115);
double r184117 = r184115 * r184116;
double r184118 = x;
double r184119 = r184117 - r184118;
double r184120 = r184116 + r184117;
double r184121 = r184119 / r184120;
double r184122 = r184115 - r184121;
return r184122;
}
double f(double wj, double x) {
double r184123 = wj;
double r184124 = r184123 * r184123;
double r184125 = x;
double r184126 = 2.0;
double r184127 = r184125 * r184126;
double r184128 = r184127 * r184123;
double r184129 = r184125 - r184128;
double r184130 = r184124 + r184129;
return r184130;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.3 |
Initial program 13.4
Simplified12.8
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019174
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))