wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{wj + 1}}{e^{wj}} + \left(\left(\sqrt[3]{{wj}^{4} + {wj}^{2}} \cdot \sqrt[3]{{wj}^{4} + {wj}^{2}}\right) \cdot \sqrt[3]{{wj}^{4} + {wj}^{2}} - {wj}^{3}\right)double f(double wj, double x) {
double r281682 = wj;
double r281683 = exp(r281682);
double r281684 = r281682 * r281683;
double r281685 = x;
double r281686 = r281684 - r281685;
double r281687 = r281683 + r281684;
double r281688 = r281686 / r281687;
double r281689 = r281682 - r281688;
return r281689;
}
double f(double wj, double x) {
double r281690 = x;
double r281691 = wj;
double r281692 = 1.0;
double r281693 = r281691 + r281692;
double r281694 = r281690 / r281693;
double r281695 = exp(r281691);
double r281696 = r281694 / r281695;
double r281697 = 4.0;
double r281698 = pow(r281691, r281697);
double r281699 = 2.0;
double r281700 = pow(r281691, r281699);
double r281701 = r281698 + r281700;
double r281702 = cbrt(r281701);
double r281703 = r281702 * r281702;
double r281704 = r281703 * r281702;
double r281705 = 3.0;
double r281706 = pow(r281691, r281705);
double r281707 = r281704 - r281706;
double r281708 = r281696 + r281707;
return r281708;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.5 |
|---|---|
| Target | 12.9 |
| Herbie | 1.3 |
Initial program 13.5
Simplified12.9
rmApplied associate--l+6.6
Taylor expanded around 0 1.2
rmApplied add-cube-cbrt1.3
Final simplification1.3
herbie shell --seed 2019354
(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))))))