\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 r662977 = x;
double r662978 = r662977 * r662977;
double r662979 = y;
double r662980 = r662979 * r662979;
double r662981 = r662978 + r662980;
double r662982 = z;
double r662983 = r662982 * r662982;
double r662984 = r662981 + r662983;
double r662985 = sqrt(r662984);
return r662985;
}
double f(double x, double y, double z) {
double r662986 = x;
double r662987 = y;
double r662988 = hypot(r662986, r662987);
double r662989 = z;
double r662990 = hypot(r662988, r662989);
return r662990;
}




Bits error versus x




Bits error versus y




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