\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 r775865 = x;
double r775866 = r775865 * r775865;
double r775867 = y;
double r775868 = r775867 * r775867;
double r775869 = r775866 + r775868;
double r775870 = z;
double r775871 = r775870 * r775870;
double r775872 = r775869 + r775871;
double r775873 = sqrt(r775872);
return r775873;
}
double f(double x, double y, double z) {
double r775874 = x;
double r775875 = y;
double r775876 = hypot(r775874, r775875);
double r775877 = z;
double r775878 = hypot(r775876, r775877);
return r775878;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.2 |
|---|---|
| Target | 25.9 |
| Herbie | 0.0 |
Initial program 38.2
rmApplied add-sqr-sqrt38.2
Applied hypot-def29.2
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2020047 +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))))