wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{x \cdot e^{-wj}}{wj + 1} - \left({wj}^{3} - \left({wj}^{4} + {wj}^{2}\right)\right)double f(double wj, double x) {
double r308671 = wj;
double r308672 = exp(r308671);
double r308673 = r308671 * r308672;
double r308674 = x;
double r308675 = r308673 - r308674;
double r308676 = r308672 + r308673;
double r308677 = r308675 / r308676;
double r308678 = r308671 - r308677;
return r308678;
}
double f(double wj, double x) {
double r308679 = x;
double r308680 = wj;
double r308681 = -r308680;
double r308682 = exp(r308681);
double r308683 = r308679 * r308682;
double r308684 = 1.0;
double r308685 = r308680 + r308684;
double r308686 = r308683 / r308685;
double r308687 = 3.0;
double r308688 = pow(r308680, r308687);
double r308689 = 4.0;
double r308690 = pow(r308680, r308689);
double r308691 = 2.0;
double r308692 = pow(r308680, r308691);
double r308693 = r308690 + r308692;
double r308694 = r308688 - r308693;
double r308695 = r308686 - r308694;
return r308695;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.3 |
| Herbie | 1.0 |
Initial program 13.8
Simplified13.3
rmApplied div-sub13.3
Applied associate-+l-6.9
Taylor expanded around 0 1.0
rmApplied div-inv1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2020047
(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))))))