\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(1 \cdot \mathsf{hypot}\left(x, y\right), z\right)double f(double x, double y, double z) {
double r600277 = x;
double r600278 = r600277 * r600277;
double r600279 = y;
double r600280 = r600279 * r600279;
double r600281 = r600278 + r600280;
double r600282 = z;
double r600283 = r600282 * r600282;
double r600284 = r600281 + r600283;
double r600285 = sqrt(r600284);
return r600285;
}
double f(double x, double y, double z) {
double r600286 = 1.0;
double r600287 = x;
double r600288 = y;
double r600289 = hypot(r600287, r600288);
double r600290 = r600286 * r600289;
double r600291 = z;
double r600292 = hypot(r600290, r600291);
return r600292;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.1 |
|---|---|
| Target | 25.7 |
| Herbie | 0.0 |
Initial program 38.1
rmApplied add-sqr-sqrt38.1
Applied hypot-def28.9
rmApplied *-un-lft-identity28.9
Applied sqrt-prod28.9
Simplified28.9
Simplified0.0
Final simplification0.0
herbie shell --seed 2020081 +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))))