\[\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}
\]
↓
\[\frac{\mathsf{hypot}\left(z, \mathsf{hypot}\left(y, x\right)\right)}{\sqrt{3}}
\]
(FPCore (x y z)
:precision binary64
(sqrt (/ (+ (+ (* x x) (* y y)) (* z z)) 3.0)))
↓
(FPCore (x y z) :precision binary64 (/ (hypot z (hypot y x)) (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) {
return hypot(z, hypot(y, x)) / sqrt(3.0);
}
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.hypot(z, Math.hypot(y, x)) / Math.sqrt(3.0);
}
def code(x, y, z):
return math.sqrt(((((x * x) + (y * y)) + (z * z)) / 3.0))
↓
def code(x, y, z):
return math.hypot(z, math.hypot(y, x)) / math.sqrt(3.0)
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(hypot(z, hypot(y, x)) / sqrt(3.0))
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 = hypot(z, hypot(y, x)) / sqrt(3.0);
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[z ^ 2 + N[Sqrt[y ^ 2 + x ^ 2], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sqrt[3.0], $MachinePrecision]), $MachinePrecision]
\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}
↓
\frac{\mathsf{hypot}\left(z, \mathsf{hypot}\left(y, x\right)\right)}{\sqrt{3}}
Alternatives
| Alternative 1 |
|---|
| Accuracy | 72.4% |
|---|
| Cost | 13716 |
|---|
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, x\right) \cdot \sqrt{0.3333333333333333}\\
\mathbf{if}\;z \leq 1.3 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-30}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(z \cdot z + x \cdot x\right)}\\
\mathbf{elif}\;z \leq 240000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+51}:\\
\;\;\;\;\sqrt{\frac{z \cdot z + \left(x \cdot x + y \cdot y\right)}{3}}\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 67.2% |
|---|
| Cost | 13056 |
|---|
\[\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(z, x\right)
\]
| Alternative 3 |
|---|
| Accuracy | 30.5% |
|---|
| Cost | 7760 |
|---|
\[\begin{array}{l}
t_0 := \frac{-x}{\sqrt{3}}\\
\mathbf{if}\;z \leq 1.1 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-29}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(z \cdot z + x \cdot x\right)}\\
\mathbf{elif}\;z \leq 130000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+52}:\\
\;\;\;\;\sqrt{\frac{z \cdot z + \left(x \cdot x + y \cdot y\right)}{3}}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 30.2% |
|---|
| Cost | 7632 |
|---|
\[\begin{array}{l}
t_0 := \frac{-x}{\sqrt{3}}\\
\mathbf{if}\;z \leq 1.3 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-28}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(z \cdot z + x \cdot x\right)}\\
\mathbf{elif}\;z \leq 270000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+52}:\\
\;\;\;\;\sqrt{0.3333333333333333 \cdot \left(z \cdot z\right) + 0.3333333333333333 \cdot \left(x \cdot x\right)}\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 30.1% |
|---|
| Cost | 7504 |
|---|
\[\begin{array}{l}
t_0 := \frac{-x}{\sqrt{3}}\\
t_1 := \sqrt{0.3333333333333333 \cdot \left(z \cdot z + x \cdot x\right)}\\
\mathbf{if}\;z \leq 1.3 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 800000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 27.5% |
|---|
| Cost | 6916 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+181}:\\
\;\;\;\;\frac{-x}{\sqrt{3}}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
| Alternative 7 |
|---|
| Accuracy | 30.0% |
|---|
| Cost | 6788 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -0.035:\\
\;\;\;\;\sqrt{0.3333333333333333} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \sqrt{0.3333333333333333}\\
\end{array}
\]
| Alternative 8 |
|---|
| Accuracy | 18.4% |
|---|
| Cost | 6592 |
|---|
\[z \cdot \sqrt{0.3333333333333333}
\]