\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 r1351291 = x;
double r1351292 = r1351291 * r1351291;
double r1351293 = y;
double r1351294 = r1351293 * r1351293;
double r1351295 = r1351292 + r1351294;
double r1351296 = z;
double r1351297 = r1351296 * r1351296;
double r1351298 = r1351295 + r1351297;
double r1351299 = sqrt(r1351298);
return r1351299;
}
double f(double x, double y, double z) {
double r1351300 = 1.0;
double r1351301 = x;
double r1351302 = y;
double r1351303 = hypot(r1351301, r1351302);
double r1351304 = r1351300 * r1351303;
double r1351305 = z;
double r1351306 = hypot(r1351304, r1351305);
return r1351306;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.4 |
|---|---|
| Target | 26.1 |
| Herbie | 0.0 |
Initial program 38.4
rmApplied add-sqr-sqrt38.4
Applied hypot-def29.3
rmApplied *-un-lft-identity29.3
Applied sqrt-prod29.3
Simplified29.3
Simplified0.0
Final simplification0.0
herbie shell --seed 2020034 +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))))