\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 r668352 = x;
double r668353 = r668352 * r668352;
double r668354 = y;
double r668355 = r668354 * r668354;
double r668356 = r668353 + r668355;
double r668357 = z;
double r668358 = r668357 * r668357;
double r668359 = r668356 + r668358;
double r668360 = sqrt(r668359);
return r668360;
}
double f(double x, double y, double z) {
double r668361 = x;
double r668362 = y;
double r668363 = hypot(r668361, r668362);
double r668364 = z;
double r668365 = hypot(r668363, r668364);
return r668365;
}




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 hypot-def0.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))))