wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}x + wj \cdot \left(wj - x \cdot 2\right)
double f(double wj, double x) {
double r123533 = wj;
double r123534 = exp(r123533);
double r123535 = r123533 * r123534;
double r123536 = x;
double r123537 = r123535 - r123536;
double r123538 = r123534 + r123535;
double r123539 = r123537 / r123538;
double r123540 = r123533 - r123539;
return r123540;
}
double f(double wj, double x) {
double r123541 = x;
double r123542 = wj;
double r123543 = 2.0;
double r123544 = r123541 * r123543;
double r123545 = r123542 - r123544;
double r123546 = r123542 * r123545;
double r123547 = r123541 + r123546;
return r123547;
}




Bits error versus wj




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