\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 r669314 = x;
double r669315 = r669314 * r669314;
double r669316 = y;
double r669317 = r669316 * r669316;
double r669318 = r669315 + r669317;
double r669319 = z;
double r669320 = r669319 * r669319;
double r669321 = r669318 + r669320;
double r669322 = sqrt(r669321);
return r669322;
}
double f(double x, double y, double z) {
double r669323 = 1.0;
double r669324 = x;
double r669325 = y;
double r669326 = hypot(r669324, r669325);
double r669327 = r669323 * r669326;
double r669328 = z;
double r669329 = hypot(r669327, r669328);
return r669329;
}




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.7
rmApplied *-un-lft-identity28.7
Applied sqrt-prod28.7
Simplified28.7
Simplified0.0
Final simplification0.0
herbie shell --seed 2020027 +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))))