\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 r482004 = x;
double r482005 = r482004 * r482004;
double r482006 = y;
double r482007 = r482006 * r482006;
double r482008 = r482005 + r482007;
double r482009 = z;
double r482010 = r482009 * r482009;
double r482011 = r482008 + r482010;
double r482012 = sqrt(r482011);
return r482012;
}
double f(double x, double y, double z) {
double r482013 = x;
double r482014 = y;
double r482015 = hypot(r482013, r482014);
double r482016 = z;
double r482017 = hypot(r482015, r482016);
return r482017;
}




Bits error versus x




Bits error versus y




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