wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le -3.018517982554952185653087101181203666389 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{x}{e^{wj}} - wj}{{wj}^{3} + {1}^{3}} \cdot \left(wj \cdot wj + \left(1 - wj \cdot 1\right)\right) + wj\\
\mathbf{elif}\;wj \le 9.705982152869647827141704030020491478226 \cdot 10^{-9}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{e^{wj}} - wj\right) \cdot \sqrt[3]{{\left(\frac{1}{wj + 1}\right)}^{3}} + wj\\
\end{array}double f(double wj, double x) {
double r163938 = wj;
double r163939 = exp(r163938);
double r163940 = r163938 * r163939;
double r163941 = x;
double r163942 = r163940 - r163941;
double r163943 = r163939 + r163940;
double r163944 = r163942 / r163943;
double r163945 = r163938 - r163944;
return r163945;
}
double f(double wj, double x) {
double r163946 = wj;
double r163947 = -3.018517982554952e-09;
bool r163948 = r163946 <= r163947;
double r163949 = x;
double r163950 = exp(r163946);
double r163951 = r163949 / r163950;
double r163952 = r163951 - r163946;
double r163953 = 3.0;
double r163954 = pow(r163946, r163953);
double r163955 = 1.0;
double r163956 = pow(r163955, r163953);
double r163957 = r163954 + r163956;
double r163958 = r163952 / r163957;
double r163959 = r163946 * r163946;
double r163960 = r163946 * r163955;
double r163961 = r163955 - r163960;
double r163962 = r163959 + r163961;
double r163963 = r163958 * r163962;
double r163964 = r163963 + r163946;
double r163965 = 9.705982152869648e-09;
bool r163966 = r163946 <= r163965;
double r163967 = 2.0;
double r163968 = pow(r163946, r163967);
double r163969 = r163949 + r163968;
double r163970 = r163946 * r163949;
double r163971 = r163967 * r163970;
double r163972 = r163969 - r163971;
double r163973 = r163946 + r163955;
double r163974 = r163955 / r163973;
double r163975 = pow(r163974, r163953);
double r163976 = cbrt(r163975);
double r163977 = r163952 * r163976;
double r163978 = r163977 + r163946;
double r163979 = r163966 ? r163972 : r163978;
double r163980 = r163948 ? r163964 : r163979;
return r163980;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.6 |
|---|---|
| Target | 12.9 |
| Herbie | 0.3 |
if wj < -3.018517982554952e-09Initial program 4.9
Simplified4.9
rmApplied flip3-+5.2
Applied associate-/r/5.3
Applied associate-*r*5.3
Simplified5.2
if -3.018517982554952e-09 < wj < 9.705982152869648e-09Initial program 13.4
Simplified13.4
Taylor expanded around 0 0.2
if 9.705982152869648e-09 < wj Initial program 27.0
Simplified3.2
rmApplied add-cbrt-cube3.4
Applied add-cbrt-cube3.4
Applied cbrt-undiv3.5
Simplified3.4
Final simplification0.3
herbie shell --seed 2019308
(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))))))