\[ \begin{array}{c}[x, y, z] = \mathsf{sort}([x, y, z])\\ \end{array} \]
\[\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}
\]
↓
\[\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(z, x\right)
\]
(FPCore (x y z)
:precision binary64
(sqrt (/ (+ (+ (* x x) (* y y)) (* z z)) 3.0)))
↓
(FPCore (x y z) :precision binary64 (* (sqrt 0.3333333333333333) (hypot z x)))
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) {
return sqrt(0.3333333333333333) * hypot(z, x);
}
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) {
return Math.sqrt(0.3333333333333333) * Math.hypot(z, x);
}
def code(x, y, z):
return math.sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0))
↓
def code(x, y, z):
return math.sqrt(0.3333333333333333) * math.hypot(z, x)
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)
return Float64(sqrt(0.3333333333333333) * hypot(z, x))
end
function tmp = code(x, y, z)
tmp = sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0));
end
↓
function tmp = code(x, y, z)
tmp = sqrt(0.3333333333333333) * hypot(z, x);
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_] := N[(N[Sqrt[0.3333333333333333], $MachinePrecision] * N[Sqrt[z ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]
\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}
↓
\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(z, x\right)
Alternatives
| Alternative 1 |
|---|
| Error | 12.7 |
|---|
| Cost | 13836 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+63}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(z, y\right)\\
\mathbf{elif}\;x \cdot x \leq 10^{+220}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{elif}\;x \cdot x \leq 10^{+239}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(y, x\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 13.0 |
|---|
| Cost | 13316 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+63}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(z, y\right)\\
\mathbf{elif}\;x \cdot x \leq 10^{+220}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{elif}\;x \cdot x \leq 10^{+239}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-0.5 \cdot \left(z \cdot \frac{z}{x}\right) - x\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 13.3 |
|---|
| Cost | 7884 |
|---|
\[\begin{array}{l}
t_0 := \frac{z}{\sqrt{3}}\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+66}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \cdot x \leq 10^{+220}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{elif}\;x \cdot x \leq 10^{+239}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-0.5 \cdot \left(z \cdot \frac{z}{x}\right) - x\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 14.3 |
|---|
| Cost | 7236 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.297110601513885 \cdot 10^{+101}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-0.5 \cdot \left(z \cdot \frac{z}{x}\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 14.2 |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.297110601513885 \cdot 10^{+101}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 31.4 |
|---|
| Cost | 6592 |
|---|
\[\frac{z}{\sqrt{3}}
\]