\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(z, \mathsf{hypot}\left(y, x\right)\right)double f(double x, double y, double z) {
double r449958 = x;
double r449959 = r449958 * r449958;
double r449960 = y;
double r449961 = r449960 * r449960;
double r449962 = r449959 + r449961;
double r449963 = z;
double r449964 = r449963 * r449963;
double r449965 = r449962 + r449964;
double r449966 = sqrt(r449965);
return r449966;
}
double f(double x, double y, double z) {
double r449967 = z;
double r449968 = y;
double r449969 = x;
double r449970 = hypot(r449968, r449969);
double r449971 = hypot(r449967, r449970);
return r449971;
}




Bits error versus x




Bits error versus y




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