\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 r2527 = x;
double r2528 = r2527 * r2527;
double r2529 = y;
double r2530 = r2529 * r2529;
double r2531 = r2528 + r2530;
double r2532 = z;
double r2533 = r2532 * r2532;
double r2534 = r2531 + r2533;
double r2535 = sqrt(r2534);
return r2535;
}
double f(double x, double y, double z) {
double r2536 = x;
double r2537 = y;
double r2538 = hypot(r2536, r2537);
double r2539 = z;
double r2540 = hypot(r2538, r2539);
return r2540;
}




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.3
rmApplied hypot-def0.0
Final simplification0.0
herbie shell --seed 2020025 +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))))