\[\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 |
|---|
| Error | 28.3% |
|---|
| Cost | 13452 |
|---|
\[\begin{array}{l}
t_0 := \mathsf{hypot}\left(y, x\right) \cdot \sqrt{0.3333333333333333}\\
\mathbf{if}\;z \leq 1.1 \cdot 10^{-61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+92}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 32.21% |
|---|
| Cost | 13056 |
|---|
\[\sqrt{0.3333333333333333} \cdot \mathsf{hypot}\left(z, x\right)
\]
| Alternative 3 |
|---|
| Error | 32.23% |
|---|
| Cost | 13056 |
|---|
\[\frac{\mathsf{hypot}\left(x, z\right)}{\sqrt{3}}
\]
| Alternative 4 |
|---|
| Error | 68.12% |
|---|
| Cost | 7496 |
|---|
\[\begin{array}{l}
t_0 := \frac{-x}{\sqrt{3}}\\
\mathbf{if}\;z \leq 2.2 \cdot 10^{-61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+92}:\\
\;\;\;\;\sqrt{\frac{\left(x \cdot x + y \cdot y\right) + z \cdot z}{3}}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+147}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 69.32% |
|---|
| Cost | 7117 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{+98}:\\
\;\;\;\;\frac{-x}{\sqrt{3}}\\
\mathbf{elif}\;x \leq -4.5 \cdot 10^{+84} \lor \neg \left(x \leq -5 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{x \cdot x}{3}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 69.33% |
|---|
| Cost | 7053 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{+98} \lor \neg \left(x \leq -4.5 \cdot 10^{+86}\right) \land x \leq -3.5 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \left(-\sqrt{0.3333333333333333}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 69.4% |
|---|
| Cost | 7053 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{+98}:\\
\;\;\;\;\frac{-x}{\sqrt{3}}\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{+83} \lor \neg \left(x \leq -3.5 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{z}{\sqrt{3}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-\sqrt{0.3333333333333333}\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 81.95% |
|---|
| Cost | 6592 |
|---|
\[z \cdot \sqrt{0.3333333333333333}
\]
| Alternative 9 |
|---|
| Error | 81.95% |
|---|
| Cost | 6592 |
|---|
\[\frac{z}{\sqrt{3}}
\]