\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}\mathsf{hypot}\left(z, \mathsf{hypot}\left(x, y\right)\right)double f(double x, double y, double z) {
double r421264 = x;
double r421265 = r421264 * r421264;
double r421266 = y;
double r421267 = r421266 * r421266;
double r421268 = r421265 + r421267;
double r421269 = z;
double r421270 = r421269 * r421269;
double r421271 = r421268 + r421270;
double r421272 = sqrt(r421271);
return r421272;
}
double f(double x, double y, double z) {
double r421273 = z;
double r421274 = x;
double r421275 = y;
double r421276 = hypot(r421274, r421275);
double r421277 = hypot(r421273, r421276);
return r421277;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 38.1 |
|---|---|
| Target | 25.3 |
| Herbie | 0.0 |
Initial program 38.1
Simplified38.1
rmApplied fma-udef38.1
rmApplied add-sqr-sqrt38.1
Applied hypot-def28.5
rmApplied fma-udef28.5
Applied hypot-def0.0
Final simplification0.0
herbie shell --seed 2019323 +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))))