\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right)double f(double x, double y, double z) {
double r712910 = x;
double r712911 = r712910 * r712910;
double r712912 = y;
double r712913 = r712912 * r712912;
double r712914 = r712911 + r712913;
double r712915 = z;
double r712916 = r712915 * r712915;
double r712917 = r712914 + r712916;
double r712918 = sqrt(r712917);
return r712918;
}
double f(double x, double y, double z) {
double r712919 = x;
double r712920 = y;
double r712921 = hypot(r712919, r712920);
double r712922 = z;
double r712923 = hypot(r712921, r712922);
return r712923;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.9 |
|---|---|
| Target | 26.0 |
| Herbie | 0.0 |
Initial program 38.9
rmApplied add-sqr-sqrt38.9
Applied hypot-def29.4
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2020002 +o rules:numerics
(FPCore (x y z)
:name "FRP.Yampa.Vector3:vector3Rho from Yampa-0.10.2"
:precision binary64
:herbie-target
(if (< z -6.396479394109776e+136) (- z) (if (< z 7.320293694404182e+117) (sqrt (+ (+ (* z z) (* x x)) (* y y))) z))
(sqrt (+ (+ (* x x) (* y y)) (* z z))))