wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le 7.40731419406560759 \cdot 10^{-9}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{x}{{wj}^{3} + 1}}{\frac{e^{wj}}{wj \cdot wj + \left(1 - wj \cdot 1\right)}} + wj\right) - \frac{wj}{wj + 1}\\
\end{array}double f(double wj, double x) {
double r235845 = wj;
double r235846 = exp(r235845);
double r235847 = r235845 * r235846;
double r235848 = x;
double r235849 = r235847 - r235848;
double r235850 = r235846 + r235847;
double r235851 = r235849 / r235850;
double r235852 = r235845 - r235851;
return r235852;
}
double f(double wj, double x) {
double r235853 = wj;
double r235854 = 7.4073141940656076e-09;
bool r235855 = r235853 <= r235854;
double r235856 = x;
double r235857 = 2.0;
double r235858 = pow(r235853, r235857);
double r235859 = r235856 + r235858;
double r235860 = r235853 * r235856;
double r235861 = r235857 * r235860;
double r235862 = r235859 - r235861;
double r235863 = 3.0;
double r235864 = pow(r235853, r235863);
double r235865 = 1.0;
double r235866 = r235864 + r235865;
double r235867 = r235856 / r235866;
double r235868 = exp(r235853);
double r235869 = r235853 * r235853;
double r235870 = r235853 * r235865;
double r235871 = r235865 - r235870;
double r235872 = r235869 + r235871;
double r235873 = r235868 / r235872;
double r235874 = r235867 / r235873;
double r235875 = r235874 + r235853;
double r235876 = r235853 + r235865;
double r235877 = r235853 / r235876;
double r235878 = r235875 - r235877;
double r235879 = r235855 ? r235862 : r235878;
return r235879;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.6 |
|---|---|
| Target | 13.0 |
| Herbie | 1.0 |
if wj < 7.4073141940656076e-09Initial program 13.3
Simplified13.3
Taylor expanded around 0 0.9
if 7.4073141940656076e-09 < wj Initial program 22.9
Simplified3.5
rmApplied flip3-+3.5
Applied associate-/r/3.5
Applied associate-/l*3.5
Simplified3.5
Final simplification1.0
herbie shell --seed 2020003
(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))))))