\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}\sqrt{0.5 \cdot \sqrt[3]{{\left(1 + x \cdot {\left(\left(4 \cdot p\right) \cdot p + x \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right)}^{3}}}double code(double p, double x) {
return sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
}
double code(double p, double x) {
return sqrt((0.5 * cbrt(pow((1.0 + (x * pow((((4.0 * p) * p) + (x * x)), -0.5))), 3.0))));
}




Bits error versus p




Bits error versus x
Results
| Original | 13.7 |
|---|---|
| Target | 13.7 |
| Herbie | 14.0 |
Initial program 13.7
rmApplied div-inv14.0
rmApplied pow1/214.0
Applied pow-flip14.0
rmApplied add-cbrt-cube14.0
Simplified14.0
Final simplification14.0
herbie shell --seed 2020058
(FPCore (p x)
:name "Given's Rotation SVD example"
:precision binary64
:pre (< 1e-150 (fabs x) 1e+150)
:herbie-target
(sqrt (+ 0.5 (/ (copysign 0.5 x) (hypot 1 (/ (* 2 p) x)))))
(sqrt (* 0.5 (+ 1 (/ x (sqrt (+ (* (* 4 p) p) (* x x))))))))