wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}x + \left(wj \cdot wj - 2 \cdot \left(x \cdot wj\right)\right)
double f(double wj, double x) {
double r4137775 = wj;
double r4137776 = exp(r4137775);
double r4137777 = r4137775 * r4137776;
double r4137778 = x;
double r4137779 = r4137777 - r4137778;
double r4137780 = r4137776 + r4137777;
double r4137781 = r4137779 / r4137780;
double r4137782 = r4137775 - r4137781;
return r4137782;
}
double f(double wj, double x) {
double r4137783 = x;
double r4137784 = wj;
double r4137785 = r4137784 * r4137784;
double r4137786 = 2.0;
double r4137787 = r4137783 * r4137784;
double r4137788 = r4137786 * r4137787;
double r4137789 = r4137785 - r4137788;
double r4137790 = r4137783 + r4137789;
return r4137790;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.0 |
Initial program 13.8
Taylor expanded around 0 2.0
Simplified2.1
rmApplied sub-neg2.1
Applied associate-+l+2.1
Simplified2.0
Final simplification2.0
herbie shell --seed 2019154
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))