\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 r661662 = x;
double r661663 = r661662 * r661662;
double r661664 = y;
double r661665 = r661664 * r661664;
double r661666 = r661663 + r661665;
double r661667 = z;
double r661668 = r661667 * r661667;
double r661669 = r661666 + r661668;
double r661670 = sqrt(r661669);
return r661670;
}
double f(double x, double y, double z) {
double r661671 = 1.0;
double r661672 = x;
double r661673 = y;
double r661674 = hypot(r661672, r661673);
double r661675 = r661671 * r661674;
double r661676 = z;
double r661677 = hypot(r661675, r661676);
return r661677;
}




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))))