wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le 3.256044322215378018516810255250648609149 \cdot 10^{-7}:\\
\;\;\;\;\left(x - \left(wj \cdot x + {wj}^{3}\right)\right) - \left(-wj\right) \cdot \frac{wj - \frac{x}{e^{wj}}}{1 - {wj}^{2}}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj - \frac{x}{e^{wj}}}{1 - {wj}^{2}} \cdot \left(1 - wj\right)\\
\end{array}double f(double wj, double x) {
double r136666 = wj;
double r136667 = exp(r136666);
double r136668 = r136666 * r136667;
double r136669 = x;
double r136670 = r136668 - r136669;
double r136671 = r136667 + r136668;
double r136672 = r136670 / r136671;
double r136673 = r136666 - r136672;
return r136673;
}
double f(double wj, double x) {
double r136674 = wj;
double r136675 = 3.256044322215378e-07;
bool r136676 = r136674 <= r136675;
double r136677 = x;
double r136678 = r136674 * r136677;
double r136679 = 3.0;
double r136680 = pow(r136674, r136679);
double r136681 = r136678 + r136680;
double r136682 = r136677 - r136681;
double r136683 = -r136674;
double r136684 = exp(r136674);
double r136685 = r136677 / r136684;
double r136686 = r136674 - r136685;
double r136687 = 1.0;
double r136688 = 2.0;
double r136689 = pow(r136674, r136688);
double r136690 = r136687 - r136689;
double r136691 = r136686 / r136690;
double r136692 = r136683 * r136691;
double r136693 = r136682 - r136692;
double r136694 = r136687 - r136674;
double r136695 = r136691 * r136694;
double r136696 = r136674 - r136695;
double r136697 = r136676 ? r136693 : r136696;
return r136697;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.6 |
|---|---|
| Target | 12.9 |
| Herbie | 0.6 |
if wj < 3.256044322215378e-07Initial program 13.2
Simplified13.2
rmApplied flip-+13.2
Applied associate-/r/13.2
Simplified13.2
rmApplied sub-neg13.2
Applied distribute-rgt-in13.2
Applied associate--r+7.2
Simplified7.2
Taylor expanded around 0 0.5
if 3.256044322215378e-07 < wj Initial program 30.3
Simplified2.1
rmApplied flip-+2.2
Applied associate-/r/2.1
Simplified2.1
Final simplification0.6
herbie shell --seed 2019212
(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))))))