wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj - x \cdot 2\right) \cdot wj + x
double f(double wj, double x) {
double r7836425 = wj;
double r7836426 = exp(r7836425);
double r7836427 = r7836425 * r7836426;
double r7836428 = x;
double r7836429 = r7836427 - r7836428;
double r7836430 = r7836426 + r7836427;
double r7836431 = r7836429 / r7836430;
double r7836432 = r7836425 - r7836431;
return r7836432;
}
double f(double wj, double x) {
double r7836433 = wj;
double r7836434 = x;
double r7836435 = 2.0;
double r7836436 = r7836434 * r7836435;
double r7836437 = r7836433 - r7836436;
double r7836438 = r7836437 * r7836433;
double r7836439 = r7836438 + r7836434;
return r7836439;
}




Bits error versus wj




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