wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\begin{array}{l}
\mathbf{if}\;wj \le -6.1770903366602869 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{\frac{x}{wj + 1} \cdot \frac{1}{e^{wj}} + wj}, \sqrt[3]{\frac{x}{wj + 1} \cdot \frac{1}{e^{wj}} + wj} \cdot \sqrt[3]{\frac{x}{wj + 1} \cdot \frac{1}{e^{wj}} + wj}, \frac{-{\left(\sqrt[3]{wj}\right)}^{3}}{wj + 1}\right) + \left(\frac{{\left(\sqrt[3]{wj}\right)}^{3}}{1 \cdot \left(wj + 1\right)} + \frac{-{\left(\sqrt[3]{wj}\right)}^{3}}{wj + 1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + {wj}^{2}\right) - 2 \cdot \left(wj \cdot x\right)\\
\end{array}double f(double wj, double x) {
double r256640 = wj;
double r256641 = exp(r256640);
double r256642 = r256640 * r256641;
double r256643 = x;
double r256644 = r256642 - r256643;
double r256645 = r256641 + r256642;
double r256646 = r256644 / r256645;
double r256647 = r256640 - r256646;
return r256647;
}
double f(double wj, double x) {
double r256648 = wj;
double r256649 = -6.177090336660287e-09;
bool r256650 = r256648 <= r256649;
double r256651 = x;
double r256652 = 1.0;
double r256653 = r256648 + r256652;
double r256654 = r256651 / r256653;
double r256655 = exp(r256648);
double r256656 = r256652 / r256655;
double r256657 = r256654 * r256656;
double r256658 = r256657 + r256648;
double r256659 = cbrt(r256658);
double r256660 = r256659 * r256659;
double r256661 = cbrt(r256648);
double r256662 = 3.0;
double r256663 = pow(r256661, r256662);
double r256664 = -r256663;
double r256665 = r256664 / r256653;
double r256666 = fma(r256659, r256660, r256665);
double r256667 = r256652 * r256653;
double r256668 = r256663 / r256667;
double r256669 = r256668 + r256665;
double r256670 = r256666 + r256669;
double r256671 = 2.0;
double r256672 = pow(r256648, r256671);
double r256673 = r256651 + r256672;
double r256674 = r256648 * r256651;
double r256675 = r256671 * r256674;
double r256676 = r256673 - r256675;
double r256677 = r256650 ? r256670 : r256676;
return r256677;
}




Bits error versus wj




Bits error versus x
| Original | 14.1 |
|---|---|
| Target | 13.5 |
| Herbie | 1.5 |
if wj < -6.177090336660287e-09Initial program 4.9
Simplified4.7
rmApplied div-inv4.7
rmApplied *-un-lft-identity4.7
Applied add-cube-cbrt5.9
Applied times-frac6.0
Applied add-cube-cbrt5.7
Applied prod-diff5.5
Simplified5.6
Simplified5.6
if -6.177090336660287e-09 < wj Initial program 14.2
Simplified13.6
Taylor expanded around 0 1.4
Final simplification1.5
herbie shell --seed 2020100 +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))))))