\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(1 \cdot \mathsf{hypot}\left(x, y\right), z\right)double f(double x, double y, double z) {
double r587922 = x;
double r587923 = r587922 * r587922;
double r587924 = y;
double r587925 = r587924 * r587924;
double r587926 = r587923 + r587925;
double r587927 = z;
double r587928 = r587927 * r587927;
double r587929 = r587926 + r587928;
double r587930 = sqrt(r587929);
return r587930;
}
double f(double x, double y, double z) {
double r587931 = 1.0;
double r587932 = x;
double r587933 = y;
double r587934 = hypot(r587932, r587933);
double r587935 = r587931 * r587934;
double r587936 = z;
double r587937 = hypot(r587935, r587936);
return r587937;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.3 |
|---|---|
| Target | 25.6 |
| Herbie | 0.0 |
Initial program 38.3
rmApplied add-sqr-sqrt38.3
Applied hypot-def29.1
rmApplied *-un-lft-identity29.1
Applied sqrt-prod29.1
Simplified29.1
Simplified0.0
Final simplification0.0
herbie shell --seed 2020033 +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))))