wj - \frac{wj \cdot e^{wj} - x}{e^{wj} + wj \cdot e^{wj}}x + \left(\left(\sqrt{\left(wj \cdot wj\right) \cdot \left(\sqrt[3]{x \cdot 2.5 + \left(1 - wj\right)} \cdot \sqrt[3]{x \cdot 2.5 + \left(1 - wj\right)}\right)} \cdot \sqrt{\left(wj \cdot wj\right) \cdot \left(\sqrt[3]{x \cdot 2.5 + \left(1 - wj\right)} \cdot \sqrt[3]{x \cdot 2.5 + \left(1 - wj\right)}\right)}\right) \cdot \sqrt[3]{\left(x \cdot 2.5 + 1\right) - wj} - x \cdot \left(2.6666666666666665 \cdot {wj}^{3} + \left(wj + wj\right)\right)\right)(FPCore (wj x) :precision binary64 (- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))
(FPCore (wj x)
:precision binary64
(+
x
(-
(*
(*
(sqrt
(*
(* wj wj)
(* (cbrt (+ (* x 2.5) (- 1.0 wj))) (cbrt (+ (* x 2.5) (- 1.0 wj))))))
(sqrt
(*
(* wj wj)
(* (cbrt (+ (* x 2.5) (- 1.0 wj))) (cbrt (+ (* x 2.5) (- 1.0 wj)))))))
(cbrt (- (+ (* x 2.5) 1.0) wj)))
(* x (+ (* 2.6666666666666665 (pow wj 3.0)) (+ wj wj))))))double code(double wj, double x) {
return wj - (((wj * exp(wj)) - x) / (exp(wj) + (wj * exp(wj))));
}
double code(double wj, double x) {
return x + (((sqrt((wj * wj) * (cbrt((x * 2.5) + (1.0 - wj)) * cbrt((x * 2.5) + (1.0 - wj)))) * sqrt((wj * wj) * (cbrt((x * 2.5) + (1.0 - wj)) * cbrt((x * 2.5) + (1.0 - wj))))) * cbrt(((x * 2.5) + 1.0) - wj)) - (x * ((2.6666666666666665 * pow(wj, 3.0)) + (wj + wj))));
}




Bits error versus wj




Bits error versus x
Results
| Original | 13.6 |
|---|---|
| Target | 13.0 |
| Herbie | 1.8 |
Initial program 13.6
Taylor expanded around 0 1.8
Simplified1.8
Taylor expanded around 0 1.8
Simplified1.8
rmApplied add-cube-cbrt_binary64_31821.8
Applied associate-*r*_binary64_30871.8
Simplified1.8
rmApplied add-sqr-sqrt_binary64_31691.8
Final simplification1.8
herbie shell --seed 2021058
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
:herbie-target
(- wj (- (/ wj (+ wj 1.0)) (/ x (+ (exp wj) (* wj (exp wj))))))
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))