\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 r1148514 = x;
double r1148515 = r1148514 * r1148514;
double r1148516 = y;
double r1148517 = r1148516 * r1148516;
double r1148518 = r1148515 + r1148517;
double r1148519 = z;
double r1148520 = r1148519 * r1148519;
double r1148521 = r1148518 + r1148520;
double r1148522 = sqrt(r1148521);
return r1148522;
}
double f(double x, double y, double z) {
double r1148523 = x;
double r1148524 = y;
double r1148525 = hypot(r1148523, r1148524);
double r1148526 = z;
double r1148527 = hypot(r1148525, r1148526);
return r1148527;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 37.8 |
|---|---|
| Target | 25.5 |
| Herbie | 0.0 |
Initial program 37.8
rmApplied add-sqr-sqrt37.8
Applied hypot-def28.7
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2019306 +o rules:numerics
(FPCore (x y z)
:name "FRP.Yampa.Vector3:vector3Rho from Yampa-0.10.2"
:precision binary64
:herbie-target
(if (< z -6.3964793941097758e136) (- z) (if (< z 7.3202936944041821e117) (sqrt (+ (+ (* z z) (* x x)) (* y y))) z))
(sqrt (+ (+ (* x x) (* y y)) (* z z))))