wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}wj \cdot wj + \left(x - x \cdot \left(wj + wj\right)\right)
double f(double wj, double x) {
double r9319322 = wj;
double r9319323 = exp(r9319322);
double r9319324 = r9319322 * r9319323;
double r9319325 = x;
double r9319326 = r9319324 - r9319325;
double r9319327 = r9319323 + r9319324;
double r9319328 = r9319326 / r9319327;
double r9319329 = r9319322 - r9319328;
return r9319329;
}
double f(double wj, double x) {
double r9319330 = wj;
double r9319331 = r9319330 * r9319330;
double r9319332 = x;
double r9319333 = r9319330 + r9319330;
double r9319334 = r9319332 * r9319333;
double r9319335 = r9319332 - r9319334;
double r9319336 = r9319331 + r9319335;
return r9319336;
}




Bits error versus wj




Bits error versus x
Results
| Original | 14.2 |
|---|---|
| Target | 13.6 |
| Herbie | 2.1 |
Initial program 14.2
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019171
(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))))))