wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{e^{wj}}}{{wj}^{3} + 1} \cdot \left(wj \cdot wj + \left(1 - wj\right)\right) + \left(\mathsf{fma}\left(wj, wj, {wj}^{4}\right) - {wj}^{3}\right)double f(double wj, double x) {
double r193759 = wj;
double r193760 = exp(r193759);
double r193761 = r193759 * r193760;
double r193762 = x;
double r193763 = r193761 - r193762;
double r193764 = r193760 + r193761;
double r193765 = r193763 / r193764;
double r193766 = r193759 - r193765;
return r193766;
}
double f(double wj, double x) {
double r193767 = x;
double r193768 = wj;
double r193769 = exp(r193768);
double r193770 = r193767 / r193769;
double r193771 = 3.0;
double r193772 = pow(r193768, r193771);
double r193773 = 1.0;
double r193774 = r193772 + r193773;
double r193775 = r193770 / r193774;
double r193776 = r193768 * r193768;
double r193777 = r193773 - r193768;
double r193778 = r193776 + r193777;
double r193779 = r193775 * r193778;
double r193780 = 4.0;
double r193781 = pow(r193768, r193780);
double r193782 = fma(r193768, r193768, r193781);
double r193783 = r193782 - r193772;
double r193784 = r193779 + r193783;
return r193784;
}




Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 1.0 |
Initial program 13.4
Simplified12.9
rmApplied div-sub12.8
Applied associate--r-6.7
Taylor expanded around 0 1.0
Simplified1.0
rmApplied flip3-+1.0
Applied associate-/r/1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2020042 +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))))))