\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -8.039547558546271631628934502111036051442 \cdot 10^{104}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \le -3.240034389533803828723034610715031267776 \cdot 10^{-262}:\\
\;\;\;\;\sqrt{y \cdot y + x \cdot x}\\
\mathbf{elif}\;x \le 2.715396324398381567593668375558902625339 \cdot 10^{-222}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \le 2.683247713446899747987853789973400736076 \cdot 10^{123}:\\
\;\;\;\;\sqrt{y \cdot y + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r41730952 = x;
double r41730953 = r41730952 * r41730952;
double r41730954 = y;
double r41730955 = r41730954 * r41730954;
double r41730956 = r41730953 + r41730955;
double r41730957 = sqrt(r41730956);
return r41730957;
}
double f(double x, double y) {
double r41730958 = x;
double r41730959 = -8.039547558546272e+104;
bool r41730960 = r41730958 <= r41730959;
double r41730961 = -r41730958;
double r41730962 = -3.240034389533804e-262;
bool r41730963 = r41730958 <= r41730962;
double r41730964 = y;
double r41730965 = r41730964 * r41730964;
double r41730966 = r41730958 * r41730958;
double r41730967 = r41730965 + r41730966;
double r41730968 = sqrt(r41730967);
double r41730969 = 2.7153963243983816e-222;
bool r41730970 = r41730958 <= r41730969;
double r41730971 = 2.6832477134469e+123;
bool r41730972 = r41730958 <= r41730971;
double r41730973 = r41730972 ? r41730968 : r41730958;
double r41730974 = r41730970 ? r41730964 : r41730973;
double r41730975 = r41730963 ? r41730968 : r41730974;
double r41730976 = r41730960 ? r41730961 : r41730975;
return r41730976;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.6 |
|---|---|
| Target | 17.2 |
| Herbie | 17.1 |
if x < -8.039547558546272e+104Initial program 52.4
Taylor expanded around -inf 9.5
Simplified9.5
if -8.039547558546272e+104 < x < -3.240034389533804e-262 or 2.7153963243983816e-222 < x < 2.6832477134469e+123Initial program 19.0
if -3.240034389533804e-262 < x < 2.7153963243983816e-222Initial program 32.1
Taylor expanded around 0 31.4
if 2.6832477134469e+123 < x Initial program 55.3
Taylor expanded around inf 8.3
Final simplification17.1
herbie shell --seed 2019200
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:herbie-target
(if (< x -1.1236950826599826e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))