\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -2.27109209614237641 \cdot 10^{59}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 9.6349667233636427 \cdot 10^{131}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r824958 = x;
double r824959 = r824958 * r824958;
double r824960 = y;
double r824961 = r824960 * r824960;
double r824962 = r824959 + r824961;
double r824963 = sqrt(r824962);
return r824963;
}
double f(double x, double y) {
double r824964 = x;
double r824965 = -2.2710920961423764e+59;
bool r824966 = r824964 <= r824965;
double r824967 = -1.0;
double r824968 = r824967 * r824964;
double r824969 = 9.634966723363643e+131;
bool r824970 = r824964 <= r824969;
double r824971 = r824964 * r824964;
double r824972 = y;
double r824973 = r824972 * r824972;
double r824974 = r824971 + r824973;
double r824975 = sqrt(r824974);
double r824976 = r824970 ? r824975 : r824964;
double r824977 = r824966 ? r824968 : r824976;
return r824977;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 17.9 |
| Herbie | 18.2 |
if x < -2.2710920961423764e+59Initial program 45.1
Taylor expanded around -inf 12.9
if -2.2710920961423764e+59 < x < 9.634966723363643e+131Initial program 22.0
if 9.634966723363643e+131 < x Initial program 57.8
Taylor expanded around inf 8.5
Final simplification18.2
herbie shell --seed 2020062
(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))))