\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 r602506 = x;
double r602507 = r602506 * r602506;
double r602508 = y;
double r602509 = r602508 * r602508;
double r602510 = r602507 + r602509;
double r602511 = z;
double r602512 = r602511 * r602511;
double r602513 = r602510 + r602512;
double r602514 = sqrt(r602513);
return r602514;
}
double f(double x, double y, double z) {
double r602515 = x;
double r602516 = y;
double r602517 = hypot(r602515, r602516);
double r602518 = z;
double r602519 = hypot(r602517, r602518);
return r602519;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.6 |
|---|---|
| Target | 26.1 |
| Herbie | 0.0 |
Initial program 38.6
rmApplied add-sqr-sqrt38.6
Applied hypot-def29.5
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2020020 +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))))