wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}\left(wj \cdot wj + \left(wj \cdot wj - wj\right) \cdot \left(wj \cdot wj\right)\right) + \frac{1}{e^{wj}} \cdot \frac{x}{1 + wj}double f(double wj, double x) {
double r7787106 = wj;
double r7787107 = exp(r7787106);
double r7787108 = r7787106 * r7787107;
double r7787109 = x;
double r7787110 = r7787108 - r7787109;
double r7787111 = r7787107 + r7787108;
double r7787112 = r7787110 / r7787111;
double r7787113 = r7787106 - r7787112;
return r7787113;
}
double f(double wj, double x) {
double r7787114 = wj;
double r7787115 = r7787114 * r7787114;
double r7787116 = r7787115 - r7787114;
double r7787117 = r7787116 * r7787115;
double r7787118 = r7787115 + r7787117;
double r7787119 = 1.0;
double r7787120 = exp(r7787114);
double r7787121 = r7787119 / r7787120;
double r7787122 = x;
double r7787123 = r7787119 + r7787114;
double r7787124 = r7787122 / r7787123;
double r7787125 = r7787121 * r7787124;
double r7787126 = r7787118 + r7787125;
return r7787126;
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.5 |
|---|---|
| Target | 12.9 |
| Herbie | 1.1 |
Initial program 13.5
rmApplied div-sub13.5
Applied associate--r-7.5
Taylor expanded around 0 1.1
Simplified1.1
rmApplied *-un-lft-identity1.1
Applied distribute-rgt-out1.1
Applied *-un-lft-identity1.1
Applied times-frac1.1
Final simplification1.1
herbie shell --seed 2019172
(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))))))