\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(\mathsf{hypot}\left(y, x\right), z\right)double f(double x, double y, double z) {
double r606777 = x;
double r606778 = r606777 * r606777;
double r606779 = y;
double r606780 = r606779 * r606779;
double r606781 = r606778 + r606780;
double r606782 = z;
double r606783 = r606782 * r606782;
double r606784 = r606781 + r606783;
double r606785 = sqrt(r606784);
return r606785;
}
double f(double x, double y, double z) {
double r606786 = y;
double r606787 = x;
double r606788 = hypot(r606786, r606787);
double r606789 = z;
double r606790 = hypot(r606788, r606789);
return r606790;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.1 |
|---|---|
| Target | 25.2 |
| Herbie | 0.0 |
Initial program 38.1
rmApplied add-sqr-sqrt38.1
Applied hypot-def28.6
rmApplied *-un-lft-identity28.6
Applied sqrt-prod28.6
Simplified28.6
Simplified0.0
Final simplification0.0
herbie shell --seed 2019196 +o rules:numerics
(FPCore (x y z)
:name "FRP.Yampa.Vector3:vector3Rho from Yampa-0.10.2"
: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))))