\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\sqrt{\frac{1}{3}} \cdot \mathsf{hypot}\left(z, \mathsf{hypot}\left(x, y\right)\right)double f(double x, double y, double z) {
double r901776 = x;
double r901777 = r901776 * r901776;
double r901778 = y;
double r901779 = r901778 * r901778;
double r901780 = r901777 + r901779;
double r901781 = z;
double r901782 = r901781 * r901781;
double r901783 = r901780 + r901782;
double r901784 = 3.0;
double r901785 = r901783 / r901784;
double r901786 = sqrt(r901785);
return r901786;
}
double f(double x, double y, double z) {
double r901787 = 1.0;
double r901788 = 3.0;
double r901789 = r901787 / r901788;
double r901790 = sqrt(r901789);
double r901791 = z;
double r901792 = x;
double r901793 = y;
double r901794 = hypot(r901792, r901793);
double r901795 = hypot(r901791, r901794);
double r901796 = r901790 * r901795;
return r901796;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 37.6 |
|---|---|
| Target | 25.2 |
| Herbie | 0.4 |
Initial program 37.6
rmApplied add-sqr-sqrt37.6
Applied associate-/l*37.6
rmApplied add-sqr-sqrt37.6
Applied hypot-def37.6
rmApplied div-inv37.6
Applied *-un-lft-identity37.6
Applied times-frac37.6
Applied sqrt-prod37.7
Simplified0.4
Final simplification0.4
herbie shell --seed 2020035 +o rules:numerics
(FPCore (x y z)
:name "Data.Array.Repa.Algorithms.Pixel:doubleRmsOfRGB8 from repa-algorithms-3.4.0.1"
:precision binary64
:herbie-target
(if (< z -6.396479394109776e+136) (/ (- z) (sqrt 3)) (if (< z 7.320293694404182e+117) (/ (sqrt (+ (+ (* z z) (* x x)) (* y y))) (sqrt 3)) (* (sqrt 0.3333333333333333) z)))
(sqrt (/ (+ (+ (* x x) (* y y)) (* z z)) 3)))