\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}\sqrt{0.5 \cdot \frac{\frac{{\left({1}^{3}\right)}^{3} + {\left({\left(x \cdot \frac{1}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}^{3}\right)}^{3}}{\left({1}^{6} + {\left(x \cdot \frac{1}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}^{6}\right) - {1}^{3} \cdot {\left(x \cdot \frac{1}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}^{3}}}{\frac{1}{\left(4 \cdot p\right) \cdot p + x \cdot x} \cdot {x}^{2} - \left(\frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}} \cdot 1 - 1 \cdot 1\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 * (((pow(pow(1.0, 3.0), 3.0) + pow(pow((x * (1.0 / sqrt((((4.0 * p) * p) + (x * x))))), 3.0), 3.0)) / ((pow(1.0, 6.0) + pow((x * (1.0 / sqrt((((4.0 * p) * p) + (x * x))))), 6.0)) - (pow(1.0, 3.0) * pow((x * (1.0 / sqrt((((4.0 * p) * p) + (x * x))))), 3.0)))) / (((1.0 / (((4.0 * p) * p) + (x * x))) * pow(x, 2.0)) - (((x / sqrt((((4.0 * p) * p) + (x * x)))) * 1.0) - (1.0 * 1.0))))));
}




Bits error versus p




Bits error versus x
Results
| Original | 12.9 |
|---|---|
| Target | 12.9 |
| Herbie | 13.1 |
Initial program 12.9
rmApplied div-inv13.1
rmApplied flip3-+13.1
Simplified13.1
rmApplied flip3-+13.1
Simplified13.1
Final simplification13.1
herbie shell --seed 2020060
(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))))))))