\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 r769902 = x;
double r769903 = r769902 * r769902;
double r769904 = y;
double r769905 = r769904 * r769904;
double r769906 = r769903 + r769905;
double r769907 = z;
double r769908 = r769907 * r769907;
double r769909 = r769906 + r769908;
double r769910 = sqrt(r769909);
return r769910;
}
double f(double x, double y, double z) {
double r769911 = x;
double r769912 = y;
double r769913 = hypot(r769911, r769912);
double r769914 = z;
double r769915 = hypot(r769913, r769914);
return r769915;
}




Bits error versus x




Bits error versus y




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