wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le -1.1501535783428499 \cdot 10^{-8}:\\
\;\;\;\;\left(\frac{x}{wj \cdot wj - 1} \cdot \frac{wj - 1}{e^{wj}} + wj\right) - \frac{\sqrt[3]{wj} \cdot \sqrt[3]{wj}}{\frac{wj + 1}{\sqrt[3]{wj}}}\\
\mathbf{else}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\end{array}double f(double wj, double x) {
double r228856 = wj;
double r228857 = exp(r228856);
double r228858 = r228856 * r228857;
double r228859 = x;
double r228860 = r228858 - r228859;
double r228861 = r228857 + r228858;
double r228862 = r228860 / r228861;
double r228863 = r228856 - r228862;
return r228863;
}
double f(double wj, double x) {
double r228864 = wj;
double r228865 = -1.1501535783428499e-08;
bool r228866 = r228864 <= r228865;
double r228867 = x;
double r228868 = r228864 * r228864;
double r228869 = 1.0;
double r228870 = r228868 - r228869;
double r228871 = r228867 / r228870;
double r228872 = r228864 - r228869;
double r228873 = exp(r228864);
double r228874 = r228872 / r228873;
double r228875 = r228871 * r228874;
double r228876 = r228875 + r228864;
double r228877 = cbrt(r228864);
double r228878 = r228877 * r228877;
double r228879 = r228864 + r228869;
double r228880 = r228879 / r228877;
double r228881 = r228878 / r228880;
double r228882 = r228876 - r228881;
double r228883 = 2.0;
double r228884 = pow(r228864, r228883);
double r228885 = r228867 + r228884;
double r228886 = r228864 * r228867;
double r228887 = r228883 * r228886;
double r228888 = r228885 - r228887;
double r228889 = r228866 ? r228882 : r228888;
return r228889;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.3 |
| Herbie | 1.4 |
if wj < -1.1501535783428499e-08Initial program 4.4
Simplified4.3
rmApplied *-un-lft-identity4.3
Applied flip-+4.4
Applied associate-/r/4.3
Applied times-frac4.4
Simplified4.4
rmApplied add-cube-cbrt5.3
Applied associate-/l*5.3
if -1.1501535783428499e-08 < wj Initial program 14.0
Simplified13.5
Taylor expanded around 0 1.3
Final simplification1.4
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))))))