wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le 1.043153900035086351654028702491698264697 \cdot 10^{-16}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{{\left({wj}^{3}\right)}^{3} + 1} \cdot \frac{\left(\left({wj}^{6} + 1\right) - {wj}^{3}\right) \cdot \left(\left(wj \cdot wj + 1\right) - wj\right)}{e^{wj}} + wj\right) - \frac{1}{\frac{wj + 1}{wj}}\\
\end{array}double f(double wj, double x) {
double r138757 = wj;
double r138758 = exp(r138757);
double r138759 = r138757 * r138758;
double r138760 = x;
double r138761 = r138759 - r138760;
double r138762 = r138758 + r138759;
double r138763 = r138761 / r138762;
double r138764 = r138757 - r138763;
return r138764;
}
double f(double wj, double x) {
double r138765 = wj;
double r138766 = 1.0431539000350864e-16;
bool r138767 = r138765 <= r138766;
double r138768 = x;
double r138769 = 2.0;
double r138770 = pow(r138765, r138769);
double r138771 = r138768 + r138770;
double r138772 = r138765 * r138768;
double r138773 = r138769 * r138772;
double r138774 = r138771 - r138773;
double r138775 = 3.0;
double r138776 = pow(r138765, r138775);
double r138777 = pow(r138776, r138775);
double r138778 = 1.0;
double r138779 = r138777 + r138778;
double r138780 = r138768 / r138779;
double r138781 = 6.0;
double r138782 = pow(r138765, r138781);
double r138783 = r138782 + r138778;
double r138784 = r138783 - r138776;
double r138785 = r138765 * r138765;
double r138786 = r138785 + r138778;
double r138787 = r138786 - r138765;
double r138788 = r138784 * r138787;
double r138789 = exp(r138765);
double r138790 = r138788 / r138789;
double r138791 = r138780 * r138790;
double r138792 = r138791 + r138765;
double r138793 = r138765 + r138778;
double r138794 = r138793 / r138765;
double r138795 = r138778 / r138794;
double r138796 = r138792 - r138795;
double r138797 = r138767 ? r138774 : r138796;
return r138797;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.1 |
| Herbie | 1.1 |
if wj < 1.0431539000350864e-16Initial program 13.4
Simplified13.4
Taylor expanded around 0 0.8
if 1.0431539000350864e-16 < wj Initial program 24.9
Simplified7.6
rmApplied clear-num7.6
rmApplied *-un-lft-identity7.6
Applied flip3-+7.7
Applied associate-/r/7.6
Applied times-frac7.6
Simplified7.6
Simplified7.6
rmApplied flip3-+7.6
Applied associate-/r/7.6
Applied associate-*l*7.6
Simplified7.6
Final simplification1.1
herbie shell --seed 2019344
(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))))))