wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\mathsf{fma}\left(wj, wj, x\right) - 2 \cdot \left(wj \cdot x\right)double f(double wj, double x) {
double r89190 = wj;
double r89191 = exp(r89190);
double r89192 = r89190 * r89191;
double r89193 = x;
double r89194 = r89192 - r89193;
double r89195 = r89191 + r89192;
double r89196 = r89194 / r89195;
double r89197 = r89190 - r89196;
return r89197;
}
double f(double wj, double x) {
double r89198 = wj;
double r89199 = x;
double r89200 = fma(r89198, r89198, r89199);
double r89201 = 2.0;
double r89202 = r89198 * r89199;
double r89203 = r89201 * r89202;
double r89204 = r89200 - r89203;
return r89204;
}




Bits error versus wj




Bits error versus x
| Original | 13.8 |
|---|---|
| Target | 13.2 |
| Herbie | 2.1 |
Initial program 13.8
Simplified13.2
Taylor expanded around 0 2.1
Simplified2.1
Final simplification2.1
herbie shell --seed 2019194 +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))))))