\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 r658335 = x;
double r658336 = r658335 * r658335;
double r658337 = y;
double r658338 = r658337 * r658337;
double r658339 = r658336 + r658338;
double r658340 = z;
double r658341 = r658340 * r658340;
double r658342 = r658339 + r658341;
double r658343 = sqrt(r658342);
return r658343;
}
double f(double x, double y, double z) {
double r658344 = x;
double r658345 = y;
double r658346 = hypot(r658344, r658345);
double r658347 = z;
double r658348 = hypot(r658346, r658347);
return r658348;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 37.5 |
|---|---|
| Target | 25.0 |
| Herbie | 0.0 |
Initial program 37.5
rmApplied add-sqr-sqrt37.5
Applied hypot-def27.9
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2020035 +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))))