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 r185182 = wj;
double r185183 = exp(r185182);
double r185184 = r185182 * r185183;
double r185185 = x;
double r185186 = r185184 - r185185;
double r185187 = r185183 + r185184;
double r185188 = r185186 / r185187;
double r185189 = r185182 - r185188;
return r185189;
}
double f(double wj, double x) {
double r185190 = x;
double r185191 = wj;
double r185192 = 2.0;
double r185193 = pow(r185191, r185192);
double r185194 = r185190 + r185193;
double r185195 = r185191 * r185190;
double r185196 = r185192 * r185195;
double r185197 = r185194 - r185196;
return r185197;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.9 |
|---|---|
| Target | 13.2 |
| Herbie | 2.2 |
Initial program 13.9
Simplified13.2
Taylor expanded around 0 2.2
Final simplification2.2
herbie shell --seed 2020025
(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))))))