wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le 0.0756709219093340962:\\
\;\;\;\;\frac{\frac{x}{e^{wj}}}{wj + 1} - \left({wj}^{3} - \left({wj}^{4} + {wj}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{{\left(\frac{x}{e^{wj}}\right)}^{3}}}{wj + 1} - \left(\frac{wj}{wj + 1} - wj\right)\\
\end{array}double f(double wj, double x) {
double r274063 = wj;
double r274064 = exp(r274063);
double r274065 = r274063 * r274064;
double r274066 = x;
double r274067 = r274065 - r274066;
double r274068 = r274064 + r274065;
double r274069 = r274067 / r274068;
double r274070 = r274063 - r274069;
return r274070;
}
double f(double wj, double x) {
double r274071 = wj;
double r274072 = 0.0756709219093341;
bool r274073 = r274071 <= r274072;
double r274074 = x;
double r274075 = exp(r274071);
double r274076 = r274074 / r274075;
double r274077 = 1.0;
double r274078 = r274071 + r274077;
double r274079 = r274076 / r274078;
double r274080 = 3.0;
double r274081 = pow(r274071, r274080);
double r274082 = 4.0;
double r274083 = pow(r274071, r274082);
double r274084 = 2.0;
double r274085 = pow(r274071, r274084);
double r274086 = r274083 + r274085;
double r274087 = r274081 - r274086;
double r274088 = r274079 - r274087;
double r274089 = pow(r274076, r274080);
double r274090 = cbrt(r274089);
double r274091 = r274090 / r274078;
double r274092 = r274071 / r274078;
double r274093 = r274092 - r274071;
double r274094 = r274091 - r274093;
double r274095 = r274073 ? r274088 : r274094;
return r274095;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.9 |
|---|---|
| Target | 13.2 |
| Herbie | 0.5 |
if wj < 0.0756709219093341Initial program 13.5
Simplified13.5
rmApplied div-sub13.5
Applied associate-+l-7.1
Taylor expanded around 0 0.4
if 0.0756709219093341 < wj Initial program 35.5
Simplified0.2
rmApplied div-sub0.2
Applied associate-+l-0.2
rmApplied add-cbrt-cube1.2
Applied add-cbrt-cube21.9
Applied cbrt-undiv21.9
Simplified7.6
Final simplification0.5
herbie shell --seed 2020043
(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))))))