\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 r622404 = x;
double r622405 = r622404 * r622404;
double r622406 = y;
double r622407 = r622406 * r622406;
double r622408 = r622405 + r622407;
double r622409 = z;
double r622410 = r622409 * r622409;
double r622411 = r622408 + r622410;
double r622412 = sqrt(r622411);
return r622412;
}
double f(double x, double y, double z) {
double r622413 = 1.0;
double r622414 = x;
double r622415 = y;
double r622416 = hypot(r622414, r622415);
double r622417 = r622413 * r622416;
double r622418 = z;
double r622419 = hypot(r622417, r622418);
return r622419;
}




Bits error versus x




Bits error versus y




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