Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{+133}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-248}:\\
\;\;\;\;\sqrt{\left(0.3333333333333333 \cdot \left(x \cdot x\right) + 0.3333333333333333 \cdot \left(z \cdot z\right)\right) + 0.3333333333333333 \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-109}:\\
\;\;\;\;\frac{\left|z\right|}{\sqrt{3}}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+121}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\end{array}
\]
(FPCore (x y z)
:precision binary64
(sqrt (/ (+ (+ (* x x) (* y y)) (* z z)) 3.0))) ↓
(FPCore (x y z)
:precision binary64
(if (<= y -1.12e+133)
(- (* y (sqrt 0.3333333333333333)))
(if (<= y 9e-248)
(sqrt
(+
(+ (* 0.3333333333333333 (* x x)) (* 0.3333333333333333 (* z z)))
(* 0.3333333333333333 (* y y))))
(if (<= y 1.95e-109)
(/ (fabs z) (sqrt 3.0))
(if (<= y 7.8e+121)
(sqrt (/ (+ (+ (* x x) (* y y)) (* z z)) 3.0))
(/ y (sqrt 3.0))))))) double code(double x, double y, double z) {
return sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
}
↓
double code(double x, double y, double z) {
double tmp;
if (y <= -1.12e+133) {
tmp = -(y * sqrt(0.3333333333333333));
} else if (y <= 9e-248) {
tmp = sqrt((((0.3333333333333333 * (x * x)) + (0.3333333333333333 * (z * z))) + (0.3333333333333333 * (y * y))));
} else if (y <= 1.95e-109) {
tmp = fabs(z) / sqrt(3.0);
} else if (y <= 7.8e+121) {
tmp = sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
} else {
tmp = y / sqrt(3.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0d0))
end function
↓
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-1.12d+133)) then
tmp = -(y * sqrt(0.3333333333333333d0))
else if (y <= 9d-248) then
tmp = sqrt((((0.3333333333333333d0 * (x * x)) + (0.3333333333333333d0 * (z * z))) + (0.3333333333333333d0 * (y * y))))
else if (y <= 1.95d-109) then
tmp = abs(z) / sqrt(3.0d0)
else if (y <= 7.8d+121) then
tmp = sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0d0))
else
tmp = y / sqrt(3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
return Math.sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
}
↓
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.12e+133) {
tmp = -(y * Math.sqrt(0.3333333333333333));
} else if (y <= 9e-248) {
tmp = Math.sqrt((((0.3333333333333333 * (x * x)) + (0.3333333333333333 * (z * z))) + (0.3333333333333333 * (y * y))));
} else if (y <= 1.95e-109) {
tmp = Math.abs(z) / Math.sqrt(3.0);
} else if (y <= 7.8e+121) {
tmp = Math.sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
} else {
tmp = y / Math.sqrt(3.0);
}
return tmp;
}
def code(x, y, z):
return math.sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0))
↓
def code(x, y, z):
tmp = 0
if y <= -1.12e+133:
tmp = -(y * math.sqrt(0.3333333333333333))
elif y <= 9e-248:
tmp = math.sqrt((((0.3333333333333333 * (x * x)) + (0.3333333333333333 * (z * z))) + (0.3333333333333333 * (y * y))))
elif y <= 1.95e-109:
tmp = math.fabs(z) / math.sqrt(3.0)
elif y <= 7.8e+121:
tmp = math.sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0))
else:
tmp = y / math.sqrt(3.0)
return tmp
function code(x, y, z)
return sqrt(Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(z * z)) / 3.0))
end
↓
function code(x, y, z)
tmp = 0.0
if (y <= -1.12e+133)
tmp = Float64(-Float64(y * sqrt(0.3333333333333333)));
elseif (y <= 9e-248)
tmp = sqrt(Float64(Float64(Float64(0.3333333333333333 * Float64(x * x)) + Float64(0.3333333333333333 * Float64(z * z))) + Float64(0.3333333333333333 * Float64(y * y))));
elseif (y <= 1.95e-109)
tmp = Float64(abs(z) / sqrt(3.0));
elseif (y <= 7.8e+121)
tmp = sqrt(Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(z * z)) / 3.0));
else
tmp = Float64(y / sqrt(3.0));
end
return tmp
end
function tmp = code(x, y, z)
tmp = sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
end
↓
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -1.12e+133)
tmp = -(y * sqrt(0.3333333333333333));
elseif (y <= 9e-248)
tmp = sqrt((((0.3333333333333333 * (x * x)) + (0.3333333333333333 * (z * z))) + (0.3333333333333333 * (y * y))));
elseif (y <= 1.95e-109)
tmp = abs(z) / sqrt(3.0);
elseif (y <= 7.8e+121)
tmp = sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
else
tmp = y / sqrt(3.0);
end
tmp_2 = tmp;
end
code[x_, y_, z_] := N[Sqrt[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]], $MachinePrecision]
↓
code[x_, y_, z_] := If[LessEqual[y, -1.12e+133], (-N[(y * N[Sqrt[0.3333333333333333], $MachinePrecision]), $MachinePrecision]), If[LessEqual[y, 9e-248], N[Sqrt[N[(N[(N[(0.3333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.95e-109], N[(N[Abs[z], $MachinePrecision] / N[Sqrt[3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.8e+121], N[Sqrt[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(z * z), $MachinePrecision]), $MachinePrecision] / 3.0), $MachinePrecision]], $MachinePrecision], N[(y / N[Sqrt[3.0], $MachinePrecision]), $MachinePrecision]]]]]
\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}
↓
\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{+133}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;y \leq 9 \cdot 10^{-248}:\\
\;\;\;\;\sqrt{\left(0.3333333333333333 \cdot \left(x \cdot x\right) + 0.3333333333333333 \cdot \left(z \cdot z\right)\right) + 0.3333333333333333 \cdot \left(y \cdot y\right)}\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{-109}:\\
\;\;\;\;\frac{\left|z\right|}{\sqrt{3}}\\
\mathbf{elif}\;y \leq 7.8 \cdot 10^{+121}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\end{array}
Alternatives Alternative 1 Error 34.1 Cost 8032
\[\begin{array}{l}
t_0 := \sqrt{0.3333333333333333 \cdot \left(z \cdot z + x \cdot x\right)}\\
t_1 := \frac{x}{\sqrt{3}}\\
t_2 := \frac{y}{\sqrt{3}}\\
\mathbf{if}\;x \leq -8.5 \cdot 10^{+117}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;x \leq -2.8 \cdot 10^{-34}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-77}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-149}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -3.7 \cdot 10^{-193}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-206}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-83}:\\
\;\;\;\;-z \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 1.12 \cdot 10^{+138}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(y \cdot y + x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 2 Error 34.2 Cost 8032
\[\begin{array}{l}
t_0 := \frac{y}{\sqrt{3}}\\
t_1 := \frac{x}{\sqrt{3}}\\
\mathbf{if}\;x \leq -4.4 \cdot 10^{+113}:\\
\;\;\;\;-t_1\\
\mathbf{elif}\;x \leq -9.2 \cdot 10^{-35}:\\
\;\;\;\;\sqrt{\frac{x \cdot x + z \cdot z}{3}}\\
\mathbf{elif}\;x \leq -2.35 \cdot 10^{-71}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -2.9 \cdot 10^{-139}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(z \cdot z + x \cdot x\right)}\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-192}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-207}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-83}:\\
\;\;\;\;-z \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+138}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(y \cdot y + x \cdot x\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Error 33.6 Cost 7636
\[\begin{array}{l}
t_0 := \sqrt{0.3333333333333333 \cdot \left(y \cdot y + x \cdot x\right)}\\
\mathbf{if}\;y \leq -7.5 \cdot 10^{+133}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-95}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-248}:\\
\;\;\;\;\frac{x}{\sqrt{3}}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-109}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;y \leq 6.1 \cdot 10^{+122}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\end{array}
\]
Alternative 4 Error 29.9 Cost 7504
\[\begin{array}{l}
t_0 := \frac{x}{\sqrt{3}}\\
\mathbf{if}\;x \leq -8 \cdot 10^{+119}:\\
\;\;\;\;-t_0\\
\mathbf{elif}\;x \leq -1.02 \cdot 10^{-32}:\\
\;\;\;\;\sqrt{\frac{x \cdot x + z \cdot z}{3}}\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{-71}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-59}:\\
\;\;\;\;\sqrt{\frac{y \cdot y + z \cdot z}{3}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 5 Error 24.8 Cost 7496
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.12 \cdot 10^{+133}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+123}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\end{array}
\]
Alternative 6 Error 36.2 Cost 7384
\[\begin{array}{l}
t_0 := y \cdot \sqrt{0.3333333333333333}\\
t_1 := \frac{x}{\sqrt{3}}\\
\mathbf{if}\;y \leq -1.5 \cdot 10^{-53}:\\
\;\;\;\;-t_0\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{-247}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2.15 \cdot 10^{-108}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;y \leq 0.047:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 7.1 \cdot 10^{+37}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+48}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\end{array}
\]
Alternative 7 Error 36.9 Cost 7184
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.01:\\
\;\;\;\;-\sqrt{0.3333333333333333} \cdot x\\
\mathbf{elif}\;x \leq -1.28 \cdot 10^{-194}:\\
\;\;\;\;-y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-213}:\\
\;\;\;\;\frac{y}{\sqrt{3}}\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-84}:\\
\;\;\;\;-z \cdot \sqrt{0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{3}}\\
\end{array}
\]
Alternative 8 Error 44.3 Cost 6856
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.26 \cdot 10^{-179}:\\
\;\;\;\;y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-76}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot x\\
\end{array}
\]
Alternative 9 Error 44.3 Cost 6856
\[\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{-180}:\\
\;\;\;\;y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-76}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{3}}\\
\end{array}
\]
Alternative 10 Error 44.3 Cost 6856
\[\begin{array}{l}
\mathbf{if}\;x \leq 1.6 \cdot 10^{-179}:\\
\;\;\;\;y \cdot \sqrt{0.3333333333333333}\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-80}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\sqrt{3}}\\
\end{array}
\]
Alternative 11 Error 44.6 Cost 6724
\[\begin{array}{l}
\mathbf{if}\;z \leq 2.3 \cdot 10^{-49}:\\
\;\;\;\;y \cdot \sqrt{0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
Alternative 12 Error 51.9 Cost 6592
\[y \cdot \sqrt{0.3333333333333333}
\]