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 r187104 = wj;
double r187105 = exp(r187104);
double r187106 = r187104 * r187105;
double r187107 = x;
double r187108 = r187106 - r187107;
double r187109 = r187105 + r187106;
double r187110 = r187108 / r187109;
double r187111 = r187104 - r187110;
return r187111;
}
double f(double wj, double x) {
double r187112 = x;
double r187113 = wj;
double r187114 = 1.0;
double r187115 = r187113 + r187114;
double r187116 = r187112 / r187115;
double r187117 = exp(r187113);
double r187118 = r187116 / r187117;
double r187119 = 4.0;
double r187120 = pow(r187113, r187119);
double r187121 = 3.0;
double r187122 = pow(r187113, r187121);
double r187123 = r187120 - r187122;
double r187124 = fma(r187113, r187113, r187123);
double r187125 = r187118 + r187124;
return r187125;
}




Bits error versus wj




Bits error versus x
| Original | 13.6 |
|---|---|
| Target | 13.0 |
| Herbie | 1.0 |
Initial program 13.6
Simplified13.0
rmApplied associate--l+6.9
Taylor expanded around 0 1.1
Simplified1.0
Final simplification1.0
herbie shell --seed 2020057 +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))))))