\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}\sqrt{0.5 \cdot \left(\left(\sqrt[3]{1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}} \cdot \sqrt[3]{1 + \frac{x}{\left|\sqrt[3]{\left(4 \cdot p\right) \cdot p + x \cdot x}\right| \cdot \sqrt{\sqrt[3]{\left(4 \cdot p\right) \cdot p + x \cdot x}}}}\right) \cdot \sqrt[3]{1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}}\right)}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((1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))) * cbrt((1.0 + (x / (fabs(cbrt((((4.0 * p) * p) + (x * x)))) * sqrt(cbrt((((4.0 * p) * p) + (x * x))))))))) * cbrt((1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))))));
}




Bits error versus p




Bits error versus x
Results
| Original | 13.5 |
|---|---|
| Target | 13.5 |
| Herbie | 13.7 |
Initial program 13.5
rmApplied add-cube-cbrt13.7
rmApplied add-cube-cbrt13.7
Applied sqrt-prod13.7
Simplified13.7
Final simplification13.7
herbie shell --seed 2020066
(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))))))))