double f(double wj, double x) {
double r22893138 = wj;
double r22893139 = exp(r22893138);
double r22893140 = r22893138 * r22893139;
double r22893141 = x;
double r22893142 = r22893140 - r22893141;
double r22893143 = r22893139 + r22893140;
double r22893144 = r22893142 / r22893143;
double r22893145 = r22893138 - r22893144;
return r22893145;
}
double f(double wj, double x) {
double r22893146 = wj;
double r22893147 = r22893146 * r22893146;
double r22893148 = r22893147 - r22893146;
double r22893149 = fma(r22893147, r22893148, r22893147);
double r22893150 = x;
double r22893151 = exp(r22893146);
double r22893152 = r22893151 * r22893146;
double r22893153 = r22893151 + r22893152;
double r22893154 = r22893150 / r22893153;
double r22893155 = r22893149 + r22893154;
return r22893155;
}
wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}(\left(wj \cdot wj\right) \cdot \left(wj \cdot wj - wj\right) + \left(wj \cdot wj\right))_* + \frac{x}{e^{wj} + e^{wj} \cdot wj}



Bits error versus wj




Bits error versus x
| Original | 13.4 |
|---|---|
| Target | 12.8 |
| Herbie | 1.1 |
Initial program 13.4
rmApplied div-sub13.4
Applied associate--r-7.3
Taylor expanded around 0 1.1
Simplified1.1
Final simplification1.1
herbie shell --seed 2019102 +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))))))