wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le 1.043153900035086351654028702491698264697 \cdot 10^{-16}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{{wj}^{3} + 1} \cdot \frac{wj \cdot wj + \left(1 - wj \cdot 1\right)}{e^{wj}} + wj\right) - \frac{1}{\frac{wj + 1}{wj}}\\
\end{array}double f(double wj, double x) {
double r263222 = wj;
double r263223 = exp(r263222);
double r263224 = r263222 * r263223;
double r263225 = x;
double r263226 = r263224 - r263225;
double r263227 = r263223 + r263224;
double r263228 = r263226 / r263227;
double r263229 = r263222 - r263228;
return r263229;
}
double f(double wj, double x) {
double r263230 = wj;
double r263231 = 1.0431539000350864e-16;
bool r263232 = r263230 <= r263231;
double r263233 = x;
double r263234 = 2.0;
double r263235 = pow(r263230, r263234);
double r263236 = r263233 + r263235;
double r263237 = r263230 * r263233;
double r263238 = r263234 * r263237;
double r263239 = r263236 - r263238;
double r263240 = 3.0;
double r263241 = pow(r263230, r263240);
double r263242 = 1.0;
double r263243 = r263241 + r263242;
double r263244 = r263233 / r263243;
double r263245 = r263230 * r263230;
double r263246 = r263230 * r263242;
double r263247 = r263242 - r263246;
double r263248 = r263245 + r263247;
double r263249 = exp(r263230);
double r263250 = r263248 / r263249;
double r263251 = r263244 * r263250;
double r263252 = r263251 + r263230;
double r263253 = r263230 + r263242;
double r263254 = r263253 / r263230;
double r263255 = r263242 / r263254;
double r263256 = r263252 - r263255;
double r263257 = r263232 ? r263239 : r263256;
return r263257;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.1 |
| Herbie | 1.1 |
if wj < 1.0431539000350864e-16Initial program 13.4
Simplified13.4
Taylor expanded around 0 0.8
if 1.0431539000350864e-16 < wj Initial program 24.9
Simplified7.6
rmApplied *-un-lft-identity7.6
Applied flip3-+7.7
Applied associate-/r/7.6
Applied times-frac7.6
Simplified7.6
Simplified7.6
rmApplied clear-num7.6
Final simplification1.1
herbie shell --seed 2019344 +o rules:numerics
(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))))))