\[ \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 | 0.8 |
|---|
| Cost | 13056 |
|---|
\[\frac{\mathsf{hypot}\left(z, x\right)}{\sqrt{3}}
\]
| Alternative 2 |
|---|
| Error | 11.8 |
|---|
| Cost | 7760 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{if}\;z \leq 1.689795153928526 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 1.3620628828259381 \cdot 10^{-73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 7.84609961846016 \cdot 10^{-48}:\\
\;\;\;\;\frac{-x}{\sqrt{3}}\\
\mathbf{elif}\;z \leq 1.7016962358190419 \cdot 10^{+139}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot z\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 13.4 |
|---|
| Cost | 7236 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -123540533935966.03:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-0.5 \cdot \left(z \cdot \frac{z}{x}\right) - x\right)\\
\mathbf{elif}\;x \leq -9.584113791128849 \cdot 10^{-5}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{elif}\;x \leq -1.324235702978373 \cdot 10^{-39}:\\
\;\;\;\;\sqrt{\frac{x \cdot x}{3}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot z\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 13.2 |
|---|
| Cost | 7116 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -123540533935966.03:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-x\right)\\
\mathbf{elif}\;x \leq -9.584113791128849 \cdot 10^{-5}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{elif}\;x \leq -1.324235702978373 \cdot 10^{-39}:\\
\;\;\;\;\sqrt{\frac{x \cdot x}{3}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot z\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 13.2 |
|---|
| Cost | 7052 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{0.3333333333333333} \cdot \left(-x\right)\\
\mathbf{if}\;x \leq -123540533935966.03:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -9.584113791128849 \cdot 10^{-5}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{elif}\;x \leq -1.324235702978373 \cdot 10^{-39}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot z\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 31.4 |
|---|
| Cost | 6592 |
|---|
\[\frac{z}{\sqrt{3}}
\]
| Alternative 7 |
|---|
| Error | 31.4 |
|---|
| Cost | 6592 |
|---|
\[\sqrt{0.3333333333333333} \cdot z
\]