\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(\sqrt{1} \cdot \mathsf{hypot}\left(x, y\right), z\right)double f(double x, double y, double z) {
double r652007 = x;
double r652008 = r652007 * r652007;
double r652009 = y;
double r652010 = r652009 * r652009;
double r652011 = r652008 + r652010;
double r652012 = z;
double r652013 = r652012 * r652012;
double r652014 = r652011 + r652013;
double r652015 = sqrt(r652014);
return r652015;
}
double f(double x, double y, double z) {
double r652016 = 1.0;
double r652017 = sqrt(r652016);
double r652018 = x;
double r652019 = y;
double r652020 = hypot(r652018, r652019);
double r652021 = r652017 * r652020;
double r652022 = z;
double r652023 = hypot(r652021, r652022);
return r652023;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 37.4 |
|---|---|
| Target | 25.4 |
| Herbie | 0.0 |
Initial program 37.4
rmApplied add-sqr-sqrt37.4
Applied hypot-def28.4
rmApplied *-un-lft-identity28.4
Applied sqrt-prod28.4
Simplified0.0
Final simplification0.0
herbie shell --seed 2020056 +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))))