wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}wj \cdot \left(wj - x \cdot 2\right) + x
double f(double wj, double x) {
double r6454046 = wj;
double r6454047 = exp(r6454046);
double r6454048 = r6454046 * r6454047;
double r6454049 = x;
double r6454050 = r6454048 - r6454049;
double r6454051 = r6454047 + r6454048;
double r6454052 = r6454050 / r6454051;
double r6454053 = r6454046 - r6454052;
return r6454053;
}
double f(double wj, double x) {
double r6454054 = wj;
double r6454055 = x;
double r6454056 = 2.0;
double r6454057 = r6454055 * r6454056;
double r6454058 = r6454054 - r6454057;
double r6454059 = r6454054 * r6454058;
double r6454060 = r6454059 + r6454055;
return r6454060;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.5 |
|---|---|
| Target | 12.8 |
| Herbie | 2.2 |
Initial program 13.5
Taylor expanded around 0 2.1
Simplified2.2
Final simplification2.2
herbie shell --seed 2019134
(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))))))