wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}wj \cdot wj + \left(x - \left(wj \cdot x\right) \cdot 2\right)
double f(double wj, double x) {
double r10347192 = wj;
double r10347193 = exp(r10347192);
double r10347194 = r10347192 * r10347193;
double r10347195 = x;
double r10347196 = r10347194 - r10347195;
double r10347197 = r10347193 + r10347194;
double r10347198 = r10347196 / r10347197;
double r10347199 = r10347192 - r10347198;
return r10347199;
}
double f(double wj, double x) {
double r10347200 = wj;
double r10347201 = r10347200 * r10347200;
double r10347202 = x;
double r10347203 = r10347200 * r10347202;
double r10347204 = 2.0;
double r10347205 = r10347203 * r10347204;
double r10347206 = r10347202 - r10347205;
double r10347207 = r10347201 + r10347206;
return r10347207;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.2 |
|---|---|
| Target | 12.6 |
| Herbie | 2.0 |
Initial program 13.2
Taylor expanded around 0 2.0
Simplified2.0
Final simplification2.0
herbie shell --seed 2019165
(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))))))