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 r203654 = wj;
double r203655 = exp(r203654);
double r203656 = r203654 * r203655;
double r203657 = x;
double r203658 = r203656 - r203657;
double r203659 = r203655 + r203656;
double r203660 = r203658 / r203659;
double r203661 = r203654 - r203660;
return r203661;
}
double f(double wj, double x) {
double r203662 = x;
double r203663 = wj;
double r203664 = r203663 * r203663;
double r203665 = r203662 + r203664;
double r203666 = -2.0;
double r203667 = r203662 * r203663;
double r203668 = r203666 * r203667;
double r203669 = r203665 + r203668;
return r203669;
}




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))))))