wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(x + wj \cdot wj\right) + -2 \cdot \left(x \cdot wj\right)
double f(double wj, double x) {
double r199813 = wj;
double r199814 = exp(r199813);
double r199815 = r199813 * r199814;
double r199816 = x;
double r199817 = r199815 - r199816;
double r199818 = r199814 + r199815;
double r199819 = r199817 / r199818;
double r199820 = r199813 - r199819;
return r199820;
}
double f(double wj, double x) {
double r199821 = x;
double r199822 = wj;
double r199823 = r199822 * r199822;
double r199824 = r199821 + r199823;
double r199825 = -2.0;
double r199826 = r199821 * r199822;
double r199827 = r199825 * r199826;
double r199828 = r199824 + r199827;
return r199828;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.1 |
Initial program 13.8
Simplified13.2
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019194
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:herbie-target
(- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))