wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\frac{\frac{x}{wj + 1}}{e^{wj}} + \mathsf{fma}\left(wj, wj, {wj}^{4} - {wj}^{3}\right)double f(double wj, double x) {
double r253206 = wj;
double r253207 = exp(r253206);
double r253208 = r253206 * r253207;
double r253209 = x;
double r253210 = r253208 - r253209;
double r253211 = r253207 + r253208;
double r253212 = r253210 / r253211;
double r253213 = r253206 - r253212;
return r253213;
}
double f(double wj, double x) {
double r253214 = x;
double r253215 = wj;
double r253216 = 1.0;
double r253217 = r253215 + r253216;
double r253218 = r253214 / r253217;
double r253219 = exp(r253215);
double r253220 = r253218 / r253219;
double r253221 = 4.0;
double r253222 = pow(r253215, r253221);
double r253223 = 3.0;
double r253224 = pow(r253215, r253223);
double r253225 = r253222 - r253224;
double r253226 = fma(r253215, r253215, r253225);
double r253227 = r253220 + r253226;
return r253227;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 0.9 |
Initial program 13.8
Simplified13.2
rmApplied associate--l+6.9
Taylor expanded around 0 0.9
Simplified0.9
Final simplification0.9
herbie shell --seed 2020056 +o rules:numerics
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))