Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{hypot}\left(y, x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+57}:\\
\;\;\;\;\mathsf{hypot}\left(z, x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+105}:\\
\;\;\;\;\mathsf{hypot}\left(z, y\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+291}:\\
\;\;\;\;\mathsf{hypot}\left(z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(z, y\right)\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (sqrt (+ (+ (* x x) (* y y)) (* z z)))) ↓
(FPCore (x y z)
:precision binary64
(if (<= (* z z) 5e-25)
(hypot y x)
(if (<= (* z z) 1e+57)
(hypot z x)
(if (<= (* z z) 1e+105)
(hypot z y)
(if (<= (* z z) 1e+291) (hypot z x) (hypot z y)))))) double code(double x, double y, double z) {
return sqrt((((x * x) + (y * y)) + (z * z)));
}
↓
double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e-25) {
tmp = hypot(y, x);
} else if ((z * z) <= 1e+57) {
tmp = hypot(z, x);
} else if ((z * z) <= 1e+105) {
tmp = hypot(z, y);
} else if ((z * z) <= 1e+291) {
tmp = hypot(z, x);
} else {
tmp = hypot(z, y);
}
return tmp;
}
public static double code(double x, double y, double z) {
return Math.sqrt((((x * x) + (y * y)) + (z * z)));
}
↓
public static double code(double x, double y, double z) {
double tmp;
if ((z * z) <= 5e-25) {
tmp = Math.hypot(y, x);
} else if ((z * z) <= 1e+57) {
tmp = Math.hypot(z, x);
} else if ((z * z) <= 1e+105) {
tmp = Math.hypot(z, y);
} else if ((z * z) <= 1e+291) {
tmp = Math.hypot(z, x);
} else {
tmp = Math.hypot(z, y);
}
return tmp;
}
def code(x, y, z):
return math.sqrt((((x * x) + (y * y)) + (z * z)))
↓
def code(x, y, z):
tmp = 0
if (z * z) <= 5e-25:
tmp = math.hypot(y, x)
elif (z * z) <= 1e+57:
tmp = math.hypot(z, x)
elif (z * z) <= 1e+105:
tmp = math.hypot(z, y)
elif (z * z) <= 1e+291:
tmp = math.hypot(z, x)
else:
tmp = math.hypot(z, y)
return tmp
function code(x, y, z)
return sqrt(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(z * z)))
end
↓
function code(x, y, z)
tmp = 0.0
if (Float64(z * z) <= 5e-25)
tmp = hypot(y, x);
elseif (Float64(z * z) <= 1e+57)
tmp = hypot(z, x);
elseif (Float64(z * z) <= 1e+105)
tmp = hypot(z, y);
elseif (Float64(z * z) <= 1e+291)
tmp = hypot(z, x);
else
tmp = hypot(z, y);
end
return tmp
end
function tmp = code(x, y, z)
tmp = sqrt((((x * x) + (y * y)) + (z * z)));
end
↓
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((z * z) <= 5e-25)
tmp = hypot(y, x);
elseif ((z * z) <= 1e+57)
tmp = hypot(z, x);
elseif ((z * z) <= 1e+105)
tmp = hypot(z, y);
elseif ((z * z) <= 1e+291)
tmp = hypot(z, x);
else
tmp = hypot(z, y);
end
tmp_2 = tmp;
end
code[x_, y_, z_] := N[Sqrt[N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
↓
code[x_, y_, z_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-25], N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+57], N[Sqrt[z ^ 2 + x ^ 2], $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+105], N[Sqrt[z ^ 2 + y ^ 2], $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+291], N[Sqrt[z ^ 2 + x ^ 2], $MachinePrecision], N[Sqrt[z ^ 2 + y ^ 2], $MachinePrecision]]]]]
\sqrt{\left(x \cdot x + y \cdot y\right) + z \cdot z}
↓
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{hypot}\left(y, x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+57}:\\
\;\;\;\;\mathsf{hypot}\left(z, x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+105}:\\
\;\;\;\;\mathsf{hypot}\left(z, y\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+291}:\\
\;\;\;\;\mathsf{hypot}\left(z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(z, y\right)\\
\end{array}
Alternatives Alternative 1 Error 13.6 Cost 7056
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+168}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq -2.75 \cdot 10^{+73}:\\
\;\;\;\;\mathsf{hypot}\left(y, x\right)\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+15}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+134}:\\
\;\;\;\;\mathsf{hypot}\left(y, x\right)\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\]
Alternative 2 Error 8.5 Cost 6792
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{hypot}\left(y, x\right)\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{+52}:\\
\;\;\;\;\mathsf{hypot}\left(z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{hypot}\left(y, x\right)\\
\end{array}
\]
Alternative 3 Error 37.6 Cost 1580
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.95 \cdot 10^{-8}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-82}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-108}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-203}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-272}:\\
\;\;\;\;y\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-203}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-137}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-46}:\\
\;\;\;\;-y\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-36}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+30}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+58}:\\
\;\;\;\;-y\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\]
Alternative 4 Error 36.7 Cost 592
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.8:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -7.2 \cdot 10^{-192}:\\
\;\;\;\;-y\\
\mathbf{elif}\;x \leq 9.4 \cdot 10^{-180}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-80}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 5 Error 36.5 Cost 460
\[\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{-31}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq 10^{-179}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 1.6 \cdot 10^{-78}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 6 Error 44.2 Cost 328
\[\begin{array}{l}
\mathbf{if}\;x \leq 7.8 \cdot 10^{-180}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-74}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 7 Error 44.2 Cost 196
\[\begin{array}{l}
\mathbf{if}\;x \leq 5.6 \cdot 10^{-57}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
Alternative 8 Error 52.0 Cost 64
\[x
\]