\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\]
↓
\[\begin{array}{l}
t_0 := \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\\
t_1 := 1 - t_0\\
t_2 := t_0 + -1\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 2:\\
\;\;\;\;\left(-0.5 \cdot \frac{\sqrt{0.5} \cdot \left(0.34375 \cdot {x}^{4}\right)}{\sqrt{2}} + \left(0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + 0.5 \cdot \frac{\sqrt{0.5} \cdot \left(0.26953125 \cdot {x}^{6}\right)}{\sqrt{2}}\right)\right) - 0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_1}}{t_1 \cdot t_1} \cdot \left(t_1 \cdot \left(\left(t_1 \cdot t_2\right) \cdot t_2\right)\right)\\
\end{array}
\]
(FPCore (x)
:precision binary64
(- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))
↓
(FPCore (x)
:precision binary64
(let* ((t_0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x))))))
(t_1 (- 1.0 t_0))
(t_2 (+ t_0 -1.0)))
(if (<= (hypot 1.0 x) 2.0)
(-
(+
(* -0.5 (/ (* (sqrt 0.5) (* 0.34375 (pow x 4.0))) (sqrt 2.0)))
(+
(* 0.25 (/ (* (sqrt 0.5) (pow x 2.0)) (sqrt 2.0)))
(* 0.5 (/ (* (sqrt 0.5) (* 0.26953125 (pow x 6.0))) (sqrt 2.0)))))
0.0)
(* (/ (/ 1.0 t_1) (* t_1 t_1)) (* t_1 (* (* t_1 t_2) t_2))))))double code(double x) {
return 1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
}
↓
double code(double x) {
double t_0 = sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
double t_1 = 1.0 - t_0;
double t_2 = t_0 + -1.0;
double tmp;
if (hypot(1.0, x) <= 2.0) {
tmp = ((-0.5 * ((sqrt(0.5) * (0.34375 * pow(x, 4.0))) / sqrt(2.0))) + ((0.25 * ((sqrt(0.5) * pow(x, 2.0)) / sqrt(2.0))) + (0.5 * ((sqrt(0.5) * (0.26953125 * pow(x, 6.0))) / sqrt(2.0))))) - 0.0;
} else {
tmp = ((1.0 / t_1) / (t_1 * t_1)) * (t_1 * ((t_1 * t_2) * t_2));
}
return tmp;
}
public static double code(double x) {
return 1.0 - Math.sqrt((0.5 * (1.0 + (1.0 / Math.hypot(1.0, x)))));
}
↓
public static double code(double x) {
double t_0 = Math.sqrt((0.5 * (1.0 + (1.0 / Math.hypot(1.0, x)))));
double t_1 = 1.0 - t_0;
double t_2 = t_0 + -1.0;
double tmp;
if (Math.hypot(1.0, x) <= 2.0) {
tmp = ((-0.5 * ((Math.sqrt(0.5) * (0.34375 * Math.pow(x, 4.0))) / Math.sqrt(2.0))) + ((0.25 * ((Math.sqrt(0.5) * Math.pow(x, 2.0)) / Math.sqrt(2.0))) + (0.5 * ((Math.sqrt(0.5) * (0.26953125 * Math.pow(x, 6.0))) / Math.sqrt(2.0))))) - 0.0;
} else {
tmp = ((1.0 / t_1) / (t_1 * t_1)) * (t_1 * ((t_1 * t_2) * t_2));
}
return tmp;
}
def code(x):
return 1.0 - math.sqrt((0.5 * (1.0 + (1.0 / math.hypot(1.0, x)))))
↓
def code(x):
t_0 = math.sqrt((0.5 * (1.0 + (1.0 / math.hypot(1.0, x)))))
t_1 = 1.0 - t_0
t_2 = t_0 + -1.0
tmp = 0
if math.hypot(1.0, x) <= 2.0:
tmp = ((-0.5 * ((math.sqrt(0.5) * (0.34375 * math.pow(x, 4.0))) / math.sqrt(2.0))) + ((0.25 * ((math.sqrt(0.5) * math.pow(x, 2.0)) / math.sqrt(2.0))) + (0.5 * ((math.sqrt(0.5) * (0.26953125 * math.pow(x, 6.0))) / math.sqrt(2.0))))) - 0.0
else:
tmp = ((1.0 / t_1) / (t_1 * t_1)) * (t_1 * ((t_1 * t_2) * t_2))
return tmp
function code(x)
return Float64(1.0 - sqrt(Float64(0.5 * Float64(1.0 + Float64(1.0 / hypot(1.0, x))))))
end
↓
function code(x)
t_0 = sqrt(Float64(0.5 * Float64(1.0 + Float64(1.0 / hypot(1.0, x)))))
t_1 = Float64(1.0 - t_0)
t_2 = Float64(t_0 + -1.0)
tmp = 0.0
if (hypot(1.0, x) <= 2.0)
tmp = Float64(Float64(Float64(-0.5 * Float64(Float64(sqrt(0.5) * Float64(0.34375 * (x ^ 4.0))) / sqrt(2.0))) + Float64(Float64(0.25 * Float64(Float64(sqrt(0.5) * (x ^ 2.0)) / sqrt(2.0))) + Float64(0.5 * Float64(Float64(sqrt(0.5) * Float64(0.26953125 * (x ^ 6.0))) / sqrt(2.0))))) - 0.0);
else
tmp = Float64(Float64(Float64(1.0 / t_1) / Float64(t_1 * t_1)) * Float64(t_1 * Float64(Float64(t_1 * t_2) * t_2)));
end
return tmp
end
function tmp = code(x)
tmp = 1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
end
↓
function tmp_2 = code(x)
t_0 = sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
t_1 = 1.0 - t_0;
t_2 = t_0 + -1.0;
tmp = 0.0;
if (hypot(1.0, x) <= 2.0)
tmp = ((-0.5 * ((sqrt(0.5) * (0.34375 * (x ^ 4.0))) / sqrt(2.0))) + ((0.25 * ((sqrt(0.5) * (x ^ 2.0)) / sqrt(2.0))) + (0.5 * ((sqrt(0.5) * (0.26953125 * (x ^ 6.0))) / sqrt(2.0))))) - 0.0;
else
tmp = ((1.0 / t_1) / (t_1 * t_1)) * (t_1 * ((t_1 * t_2) * t_2));
end
tmp_2 = tmp;
end
code[x_] := N[(1.0 - N[Sqrt[N[(0.5 * N[(1.0 + N[(1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x_] := Block[{t$95$0 = N[Sqrt[N[(0.5 * N[(1.0 + N[(1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + -1.0), $MachinePrecision]}, If[LessEqual[N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision], 2.0], N[(N[(N[(-0.5 * N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[(0.34375 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.25 * N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(N[Sqrt[0.5], $MachinePrecision] * N[(0.26953125 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.0), $MachinePrecision], N[(N[(N[(1.0 / t$95$1), $MachinePrecision] / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[(t$95$1 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
↓
\begin{array}{l}
t_0 := \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\\
t_1 := 1 - t_0\\
t_2 := t_0 + -1\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 2:\\
\;\;\;\;\left(-0.5 \cdot \frac{\sqrt{0.5} \cdot \left(0.34375 \cdot {x}^{4}\right)}{\sqrt{2}} + \left(0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + 0.5 \cdot \frac{\sqrt{0.5} \cdot \left(0.26953125 \cdot {x}^{6}\right)}{\sqrt{2}}\right)\right) - 0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_1}}{t_1 \cdot t_1} \cdot \left(t_1 \cdot \left(\left(t_1 \cdot t_2\right) \cdot t_2\right)\right)\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.4 |
|---|
| Cost | 59912 |
|---|
\[\begin{array}{l}
t_0 := {\left(1 - \sqrt{0.5}\right)}^{2}\\
t_1 := 1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
t_2 := \frac{1}{t_1}\\
t_3 := t_1 \cdot t_1\\
t_4 := t_0 \cdot t_3\\
\mathbf{if}\;x \leq -1.2:\\
\;\;\;\;t_4 \cdot \frac{t_2}{t_0}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\left(-0.5 \cdot \frac{\sqrt{0.5} \cdot \left(0.34375 \cdot {x}^{4}\right)}{\sqrt{2}} + \left(0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + 0.5 \cdot \frac{\sqrt{0.5} \cdot \left(0.26953125 \cdot {x}^{6}\right)}{\sqrt{2}}\right)\right) - 0\\
\mathbf{else}:\\
\;\;\;\;t_4 \cdot \frac{t_2}{t_3}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.4 |
|---|
| Cost | 59656 |
|---|
\[\begin{array}{l}
t_0 := {\left(1 - \sqrt{0.5}\right)}^{2}\\
t_1 := 1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
t_2 := \frac{1}{t_1}\\
t_3 := t_1 \cdot t_1\\
t_4 := t_0 \cdot t_3\\
\mathbf{if}\;x \leq -1.2:\\
\;\;\;\;t_4 \cdot \frac{t_2}{t_0}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\left(0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + \left(-0.171875 \cdot \frac{\sqrt{0.5} \cdot {x}^{4}}{\sqrt{2}} + 0.134765625 \cdot \frac{\sqrt{0.5} \cdot {x}^{6}}{\sqrt{2}}\right)\right) - 0\\
\mathbf{else}:\\
\;\;\;\;t_4 \cdot \frac{t_2}{t_3}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.5 |
|---|
| Cost | 48648 |
|---|
\[\begin{array}{l}
t_0 := {\left(1 - \sqrt{0.5}\right)}^{2}\\
t_1 := 1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
t_2 := \frac{1}{t_1}\\
t_3 := t_1 \cdot t_1\\
t_4 := t_0 \cdot t_3\\
\mathbf{if}\;x \leq -1.1:\\
\;\;\;\;t_4 \cdot \frac{t_2}{t_0}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + -0.171875 \cdot \frac{\sqrt{0.5} \cdot {x}^{4}}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;t_4 \cdot \frac{t_2}{t_3}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.6 |
|---|
| Cost | 47556 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
t_1 := {t_0}^{2}\\
t_2 := t_0 \cdot t_0\\
t_3 := 1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
\mathbf{if}\;x \leq -1.1:\\
\;\;\;\;\left(t_1 \cdot \left(t_3 \cdot t_3\right)\right) \cdot \frac{\frac{1}{t_3}}{t_1}\\
\mathbf{elif}\;x \leq 1.1:\\
\;\;\;\;0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + -0.171875 \cdot \frac{\sqrt{0.5} \cdot {x}^{4}}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_0}}{t_2} \cdot \left(t_2 \cdot t_2\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.8 |
|---|
| Cost | 46920 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
t_1 := t_0 \cdot t_0\\
\mathbf{if}\;x \leq -1.1:\\
\;\;\;\;1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
\mathbf{elif}\;x \leq 1.1:\\
\;\;\;\;0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + -0.171875 \cdot \frac{\sqrt{0.5} \cdot {x}^{4}}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{t_0}}{t_1} \cdot \left(t_1 \cdot t_1\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.8 |
|---|
| Cost | 39752 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
t_1 := 1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
\mathbf{if}\;x \leq -1.1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.02:\\
\;\;\;\;0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}} + -0.171875 \cdot \frac{\sqrt{0.5} \cdot {x}^{4}}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;{t_0}^{4} \cdot \frac{\frac{1}{t_1}}{t_1 \cdot t_0}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.8 |
|---|
| Cost | 34184 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
t_1 := 1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
\mathbf{if}\;x \leq -0.000155:\\
\;\;\;\;1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\\
\mathbf{elif}\;x \leq 1.2:\\
\;\;\;\;0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;{t_0}^{4} \cdot \frac{\frac{1}{t_1}}{t_1 \cdot t_0}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 0.8 |
|---|
| Cost | 26308 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1:\\
\;\;\;\;0.25 \cdot \frac{\sqrt{0.5} \cdot {x}^{2}}{\sqrt{2}}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 15.8 |
|---|
| Cost | 13440 |
|---|
\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\]
| Alternative 10 |
|---|
| Error | 16.4 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{x}\right)}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 16.5 |
|---|
| Cost | 7108 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;1 - \sqrt{0.5 \cdot \left(1 + \frac{-1}{x}\right)}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-77}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 16.6 |
|---|
| Cost | 6856 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-77}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 46.6 |
|---|
| Cost | 64 |
|---|
\[0
\]