\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 r712840 = x;
double r712841 = r712840 * r712840;
double r712842 = y;
double r712843 = r712842 * r712842;
double r712844 = r712841 + r712843;
double r712845 = z;
double r712846 = r712845 * r712845;
double r712847 = r712844 + r712846;
double r712848 = sqrt(r712847);
return r712848;
}
double f(double x, double y, double z) {
double r712849 = x;
double r712850 = y;
double r712851 = hypot(r712849, r712850);
double r712852 = z;
double r712853 = hypot(r712851, r712852);
return r712853;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 37.7 |
|---|---|
| Target | 25.4 |
| Herbie | 0.0 |
Initial program 37.7
rmApplied add-sqr-sqrt37.7
Applied hypot-def28.6
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2020021 +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))))