\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 r859113 = x;
double r859114 = r859113 * r859113;
double r859115 = y;
double r859116 = r859115 * r859115;
double r859117 = r859114 + r859116;
double r859118 = z;
double r859119 = r859118 * r859118;
double r859120 = r859117 + r859119;
double r859121 = sqrt(r859120);
return r859121;
}
double f(double x, double y, double z) {
double r859122 = x;
double r859123 = y;
double r859124 = hypot(r859122, r859123);
double r859125 = z;
double r859126 = hypot(r859124, r859125);
return r859126;
}




Bits error versus x




Bits error versus y




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