wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(\sqrt{\mathsf{fma}\left(wj, wj, {wj}^{4}\right)}, \sqrt{\mathsf{fma}\left(wj, wj, {wj}^{4}\right)}, -{wj}^{3}\right) + \frac{\frac{x}{e^{wj}}}{wj + 1}double f(double wj, double x) {
double r242487 = wj;
double r242488 = exp(r242487);
double r242489 = r242487 * r242488;
double r242490 = x;
double r242491 = r242489 - r242490;
double r242492 = r242488 + r242489;
double r242493 = r242491 / r242492;
double r242494 = r242487 - r242493;
return r242494;
}
double f(double wj, double x) {
double r242495 = wj;
double r242496 = 4.0;
double r242497 = pow(r242495, r242496);
double r242498 = fma(r242495, r242495, r242497);
double r242499 = sqrt(r242498);
double r242500 = 3.0;
double r242501 = pow(r242495, r242500);
double r242502 = -r242501;
double r242503 = fma(r242499, r242499, r242502);
double r242504 = x;
double r242505 = exp(r242495);
double r242506 = r242504 / r242505;
double r242507 = 1.0;
double r242508 = r242495 + r242507;
double r242509 = r242506 / r242508;
double r242510 = r242503 + r242509;
return r242510;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.3 |
| Herbie | 1.0 |
Initial program 13.8
Simplified13.3
rmApplied div-sub13.3
Applied associate--r-6.9
Taylor expanded around 0 1.0
Simplified1.0
rmApplied add-sqr-sqrt1.0
Applied fma-neg1.0
Final simplification1.0
herbie shell --seed 2020047 +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))))))