\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 r616573 = x;
double r616574 = r616573 * r616573;
double r616575 = y;
double r616576 = r616575 * r616575;
double r616577 = r616574 + r616576;
double r616578 = z;
double r616579 = r616578 * r616578;
double r616580 = r616577 + r616579;
double r616581 = sqrt(r616580);
return r616581;
}
double f(double x, double y, double z) {
double r616582 = x;
double r616583 = y;
double r616584 = hypot(r616582, r616583);
double r616585 = z;
double r616586 = hypot(r616584, r616585);
return r616586;
}




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))))