\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 r434571 = x;
double r434572 = r434571 * r434571;
double r434573 = y;
double r434574 = r434573 * r434573;
double r434575 = r434572 + r434574;
double r434576 = z;
double r434577 = r434576 * r434576;
double r434578 = r434575 + r434577;
double r434579 = sqrt(r434578);
return r434579;
}
double f(double x, double y, double z) {
double r434580 = x;
double r434581 = y;
double r434582 = hypot(r434580, r434581);
double r434583 = z;
double r434584 = hypot(r434582, r434583);
return r434584;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.0 |
|---|---|
| Target | 25.4 |
| Herbie | 0.0 |
Initial program 38.0
rmApplied add-sqr-sqrt38.0
Applied hypot-def28.8
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2019199 +o rules:numerics
(FPCore (x y z)
:name "FRP.Yampa.Vector3:vector3Rho from Yampa-0.10.2"
: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))))