wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(\mathsf{fma}\left(wj, wj, {wj}^{4}\right) - {wj}^{3}\right) + x \cdot \frac{e^{-wj}}{1 + wj}double f(double wj, double x) {
double r230143 = wj;
double r230144 = exp(r230143);
double r230145 = r230143 * r230144;
double r230146 = x;
double r230147 = r230145 - r230146;
double r230148 = r230144 + r230145;
double r230149 = r230147 / r230148;
double r230150 = r230143 - r230149;
return r230150;
}
double f(double wj, double x) {
double r230151 = wj;
double r230152 = 4.0;
double r230153 = pow(r230151, r230152);
double r230154 = fma(r230151, r230151, r230153);
double r230155 = 3.0;
double r230156 = pow(r230151, r230155);
double r230157 = r230154 - r230156;
double r230158 = x;
double r230159 = -r230151;
double r230160 = exp(r230159);
double r230161 = 1.0;
double r230162 = r230161 + r230151;
double r230163 = r230160 / r230162;
double r230164 = r230158 * r230163;
double r230165 = r230157 + r230164;
return r230165;
}




Bits error versus wj




Bits error versus x
| Original | 14.1 |
|---|---|
| Target | 13.6 |
| Herbie | 1.0 |
Initial program 14.1
Simplified13.6
rmApplied div-sub13.6
Applied associate--r-7.1
Simplified7.1
Taylor expanded around 0 1.0
Simplified1.0
rmApplied *-un-lft-identity1.0
Applied div-inv1.0
Applied times-frac1.0
Simplified1.0
Simplified1.0
Final simplification1.0
herbie shell --seed 2019198 +o rules:numerics
(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))))))