wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le 21.9702282043939157:\\
\;\;\;\;\frac{\frac{x}{wj + 1}}{e^{wj}} + \left(\left({wj}^{4} + {wj}^{2}\right) - {wj}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\frac{x}{wj + 1}} \cdot \sqrt[3]{\frac{x}{wj + 1}}\right) \cdot \frac{\sqrt[3]{\frac{x}{wj + 1}}}{e^{wj}} + \left(wj - \frac{wj}{wj + 1}\right)\\
\end{array}double f(double wj, double x) {
double r289679 = wj;
double r289680 = exp(r289679);
double r289681 = r289679 * r289680;
double r289682 = x;
double r289683 = r289681 - r289682;
double r289684 = r289680 + r289681;
double r289685 = r289683 / r289684;
double r289686 = r289679 - r289685;
return r289686;
}
double f(double wj, double x) {
double r289687 = wj;
double r289688 = 21.970228204393916;
bool r289689 = r289687 <= r289688;
double r289690 = x;
double r289691 = 1.0;
double r289692 = r289687 + r289691;
double r289693 = r289690 / r289692;
double r289694 = exp(r289687);
double r289695 = r289693 / r289694;
double r289696 = 4.0;
double r289697 = pow(r289687, r289696);
double r289698 = 2.0;
double r289699 = pow(r289687, r289698);
double r289700 = r289697 + r289699;
double r289701 = 3.0;
double r289702 = pow(r289687, r289701);
double r289703 = r289700 - r289702;
double r289704 = r289695 + r289703;
double r289705 = cbrt(r289693);
double r289706 = r289705 * r289705;
double r289707 = r289705 / r289694;
double r289708 = r289706 * r289707;
double r289709 = r289687 / r289692;
double r289710 = r289687 - r289709;
double r289711 = r289708 + r289710;
double r289712 = r289689 ? r289704 : r289711;
return r289712;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 0.5 |
if wj < 21.970228204393916Initial program 13.3
Simplified13.3
rmApplied associate--l+6.9
Taylor expanded around 0 0.5
if 21.970228204393916 < wj Initial program 50.7
Simplified0.0
rmApplied associate--l+0.0
rmApplied *-un-lft-identity0.0
Applied add-cube-cbrt0.1
Applied times-frac0.1
Simplified0.1
Final simplification0.5
herbie shell --seed 2020062
(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))))))