\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(z, \mathsf{hypot}\left(x, y\right)\right)double f(double x, double y, double z) {
double r426814 = x;
double r426815 = r426814 * r426814;
double r426816 = y;
double r426817 = r426816 * r426816;
double r426818 = r426815 + r426817;
double r426819 = z;
double r426820 = r426819 * r426819;
double r426821 = r426818 + r426820;
double r426822 = sqrt(r426821);
return r426822;
}
double f(double x, double y, double z) {
double r426823 = z;
double r426824 = x;
double r426825 = y;
double r426826 = hypot(r426824, r426825);
double r426827 = hypot(r426823, r426826);
return r426827;
}




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 fma-udef28.5
Applied hypot-def0.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))))