wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - \left(wj + wj\right) \cdot xdouble f(double wj, double x) {
double r7691231 = wj;
double r7691232 = exp(r7691231);
double r7691233 = r7691231 * r7691232;
double r7691234 = x;
double r7691235 = r7691233 - r7691234;
double r7691236 = r7691232 + r7691233;
double r7691237 = r7691235 / r7691236;
double r7691238 = r7691231 - r7691237;
return r7691238;
}
double f(double wj, double x) {
double r7691239 = wj;
double r7691240 = x;
double r7691241 = fma(r7691239, r7691239, r7691240);
double r7691242 = r7691239 + r7691239;
double r7691243 = r7691242 * r7691240;
double r7691244 = r7691241 - r7691243;
return r7691244;
}




Bits error versus wj




Bits error versus x
| Original | 13.2 |
|---|---|
| Target | 12.5 |
| Herbie | 2.1 |
Initial program 13.2
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019149 +o rules:numerics
(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))))))