\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -1.17117052004380529 \cdot 10^{89}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 2.0168808923777661 \cdot 10^{94}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r699746 = x;
double r699747 = r699746 * r699746;
double r699748 = y;
double r699749 = r699748 * r699748;
double r699750 = r699747 + r699749;
double r699751 = sqrt(r699750);
return r699751;
}
double f(double x, double y) {
double r699752 = x;
double r699753 = -1.1711705200438053e+89;
bool r699754 = r699752 <= r699753;
double r699755 = -1.0;
double r699756 = r699755 * r699752;
double r699757 = 2.016880892377766e+94;
bool r699758 = r699752 <= r699757;
double r699759 = r699752 * r699752;
double r699760 = y;
double r699761 = r699760 * r699760;
double r699762 = r699759 + r699761;
double r699763 = sqrt(r699762);
double r699764 = r699758 ? r699763 : r699752;
double r699765 = r699754 ? r699756 : r699764;
return r699765;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.8 |
|---|---|
| Target | 17.3 |
| Herbie | 17.4 |
if x < -1.1711705200438053e+89Initial program 50.6
Taylor expanded around -inf 9.7
if -1.1711705200438053e+89 < x < 2.016880892377766e+94Initial program 21.6
if 2.016880892377766e+94 < x Initial program 51.1
Taylor expanded around inf 9.6
Final simplification17.4
herbie shell --seed 2020039
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.123695082659983e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))