\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(1 \cdot \mathsf{hypot}\left(x, y\right), z\right)double f(double x, double y, double z) {
double r587585 = x;
double r587586 = r587585 * r587585;
double r587587 = y;
double r587588 = r587587 * r587587;
double r587589 = r587586 + r587588;
double r587590 = z;
double r587591 = r587590 * r587590;
double r587592 = r587589 + r587591;
double r587593 = sqrt(r587592);
return r587593;
}
double f(double x, double y, double z) {
double r587594 = 1.0;
double r587595 = x;
double r587596 = y;
double r587597 = hypot(r587595, r587596);
double r587598 = r587594 * r587597;
double r587599 = z;
double r587600 = hypot(r587598, r587599);
return r587600;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.0 |
|---|---|
| Target | 25.8 |
| Herbie | 0.0 |
Initial program 38.0
rmApplied add-sqr-sqrt38.0
Applied hypot-def28.8
rmApplied *-un-lft-identity28.8
Applied sqrt-prod28.8
Simplified28.8
Simplified0.0
Final simplification0.0
herbie shell --seed 2020001 +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))))