\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\right), z\right)double f(double x, double y, double z) {
double r655685 = x;
double r655686 = r655685 * r655685;
double r655687 = y;
double r655688 = r655687 * r655687;
double r655689 = r655686 + r655688;
double r655690 = z;
double r655691 = r655690 * r655690;
double r655692 = r655689 + r655691;
double r655693 = sqrt(r655692);
return r655693;
}
double f(double x, double y, double z) {
double r655694 = x;
double r655695 = y;
double r655696 = hypot(r655694, r655695);
double r655697 = z;
double r655698 = hypot(r655696, r655697);
return r655698;
}




Bits error versus x




Bits error versus y




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