wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot wj + \left(wj \cdot wj - wj\right) \cdot \left(wj \cdot wj\right)\right) + \frac{1}{e^{wj}} \cdot \frac{x}{1 + wj}double f(double wj, double x) {
double r9186646 = wj;
double r9186647 = exp(r9186646);
double r9186648 = r9186646 * r9186647;
double r9186649 = x;
double r9186650 = r9186648 - r9186649;
double r9186651 = r9186647 + r9186648;
double r9186652 = r9186650 / r9186651;
double r9186653 = r9186646 - r9186652;
return r9186653;
}
double f(double wj, double x) {
double r9186654 = wj;
double r9186655 = r9186654 * r9186654;
double r9186656 = r9186655 - r9186654;
double r9186657 = r9186656 * r9186655;
double r9186658 = r9186655 + r9186657;
double r9186659 = 1.0;
double r9186660 = exp(r9186654);
double r9186661 = r9186659 / r9186660;
double r9186662 = x;
double r9186663 = r9186659 + r9186654;
double r9186664 = r9186662 / r9186663;
double r9186665 = r9186661 * r9186664;
double r9186666 = r9186658 + r9186665;
return r9186666;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.5 |
|---|---|
| Target | 12.9 |
| Herbie | 1.1 |
Initial program 13.5
rmApplied div-sub13.5
Applied associate--r-7.5
Taylor expanded around 0 1.1
Simplified1.1
rmApplied *-un-lft-identity1.1
Applied distribute-rgt-out1.1
Applied *-un-lft-identity1.1
Applied times-frac1.1
Final simplification1.1
herbie shell --seed 2019172
(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))))))