wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot x\right) \cdot -2 + \mathsf{fma}\left(wj, wj, x\right)double f(double wj, double x) {
double r9781205 = wj;
double r9781206 = exp(r9781205);
double r9781207 = r9781205 * r9781206;
double r9781208 = x;
double r9781209 = r9781207 - r9781208;
double r9781210 = r9781206 + r9781207;
double r9781211 = r9781209 / r9781210;
double r9781212 = r9781205 - r9781211;
return r9781212;
}
double f(double wj, double x) {
double r9781213 = wj;
double r9781214 = x;
double r9781215 = r9781213 * r9781214;
double r9781216 = -2.0;
double r9781217 = r9781215 * r9781216;
double r9781218 = fma(r9781213, r9781213, r9781214);
double r9781219 = r9781217 + r9781218;
return r9781219;
}




Bits error versus wj




Bits error versus x
| Original | 14.1 |
|---|---|
| Target | 13.5 |
| Herbie | 2.0 |
Initial program 14.1
Taylor expanded around 0 2.0
Simplified2.0
Final simplification2.0
herbie shell --seed 2019138 +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))))))