wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le \frac{-7339392058136959}{1208925819614629174706176}:\\
\;\;\;\;\left(\frac{\frac{x}{\sqrt[3]{e^{wj}} \cdot \sqrt[3]{e^{wj}}}}{\sqrt[3]{e^{wj}}} - wj\right) \cdot \frac{1}{wj + 1} + wj\\
\mathbf{else}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\end{array}double f(double wj, double x) {
double r229778 = wj;
double r229779 = exp(r229778);
double r229780 = r229778 * r229779;
double r229781 = x;
double r229782 = r229780 - r229781;
double r229783 = r229779 + r229780;
double r229784 = r229782 / r229783;
double r229785 = r229778 - r229784;
return r229785;
}
double f(double wj, double x) {
double r229786 = wj;
double r229787 = -7339392058136959.0;
double r229788 = 1.2089258196146292e+24;
double r229789 = r229787 / r229788;
bool r229790 = r229786 <= r229789;
double r229791 = x;
double r229792 = exp(r229786);
double r229793 = cbrt(r229792);
double r229794 = r229793 * r229793;
double r229795 = r229791 / r229794;
double r229796 = r229795 / r229793;
double r229797 = r229796 - r229786;
double r229798 = 1.0;
double r229799 = r229786 + r229798;
double r229800 = r229798 / r229799;
double r229801 = r229797 * r229800;
double r229802 = r229801 + r229786;
double r229803 = 2.0;
double r229804 = pow(r229786, r229803);
double r229805 = r229791 + r229804;
double r229806 = r229786 * r229791;
double r229807 = r229803 * r229806;
double r229808 = r229805 - r229807;
double r229809 = r229790 ? r229802 : r229808;
return r229809;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.9 |
|---|---|
| Target | 13.3 |
| Herbie | 1.6 |
if wj < -6.071002818416556e-09Initial program 5.2
Simplified5.7
rmApplied add-cube-cbrt6.0
Applied associate-/r*6.0
if -6.071002818416556e-09 < wj Initial program 14.1
Simplified13.4
Taylor expanded around 0 1.5
Final simplification1.6
herbie shell --seed 2019304
(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))))))