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 r13047826 = wj;
double r13047827 = exp(r13047826);
double r13047828 = r13047826 * r13047827;
double r13047829 = x;
double r13047830 = r13047828 - r13047829;
double r13047831 = r13047827 + r13047828;
double r13047832 = r13047830 / r13047831;
double r13047833 = r13047826 - r13047832;
return r13047833;
}
double f(double wj, double x) {
double r13047834 = x;
double r13047835 = wj;
double r13047836 = r13047835 * r13047835;
double r13047837 = r13047834 + r13047836;
double r13047838 = 2.0;
double r13047839 = r13047834 * r13047835;
double r13047840 = r13047838 * r13047839;
double r13047841 = r13047837 - r13047840;
return r13047841;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 2.3 |
Initial program 13.4
Taylor expanded around 0 2.3
Simplified2.3
Final simplification2.3
herbie shell --seed 2019174
(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))))))