\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\]
↓
\[\begin{array}{l}
t_0 := \frac{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{-2}\\
t_1 := t_0 + 1\\
\mathbf{if}\;x \leq -0.0305:\\
\;\;\;\;\frac{\sqrt{\frac{0.25}{\mathsf{hypot}\left(1, x\right)} - \left(-0.5 + \frac{-0.25}{\mathsf{hypot}\left(1, x\right)}\right)}}{-2} + t_1\\
\mathbf{elif}\;x \leq 0.03:\\
\;\;\;\;\left(-0.0859375 \cdot {x}^{4} + -0.056243896484375 \cdot {x}^{8}\right) + \left(0.125 \cdot {x}^{2} + 0.0673828125 \cdot {x}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + t_1\\
\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 (/ 0.5 (hypot 1.0 x)))) -2.0)) (t_1 (+ t_0 1.0)))
(if (<= x -0.0305)
(+
(/
(sqrt (- (/ 0.25 (hypot 1.0 x)) (+ -0.5 (/ -0.25 (hypot 1.0 x)))))
-2.0)
t_1)
(if (<= x 0.03)
(+
(+ (* -0.0859375 (pow x 4.0)) (* -0.056243896484375 (pow x 8.0)))
(+ (* 0.125 (pow x 2.0)) (* 0.0673828125 (pow x 6.0))))
(+ t_0 t_1)))))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 + (0.5 / hypot(1.0, x)))) / -2.0;
double t_1 = t_0 + 1.0;
double tmp;
if (x <= -0.0305) {
tmp = (sqrt(((0.25 / hypot(1.0, x)) - (-0.5 + (-0.25 / hypot(1.0, x))))) / -2.0) + t_1;
} else if (x <= 0.03) {
tmp = ((-0.0859375 * pow(x, 4.0)) + (-0.056243896484375 * pow(x, 8.0))) + ((0.125 * pow(x, 2.0)) + (0.0673828125 * pow(x, 6.0)));
} else {
tmp = t_0 + t_1;
}
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 + (0.5 / Math.hypot(1.0, x)))) / -2.0;
double t_1 = t_0 + 1.0;
double tmp;
if (x <= -0.0305) {
tmp = (Math.sqrt(((0.25 / Math.hypot(1.0, x)) - (-0.5 + (-0.25 / Math.hypot(1.0, x))))) / -2.0) + t_1;
} else if (x <= 0.03) {
tmp = ((-0.0859375 * Math.pow(x, 4.0)) + (-0.056243896484375 * Math.pow(x, 8.0))) + ((0.125 * Math.pow(x, 2.0)) + (0.0673828125 * Math.pow(x, 6.0)));
} else {
tmp = t_0 + t_1;
}
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 + (0.5 / math.hypot(1.0, x)))) / -2.0
t_1 = t_0 + 1.0
tmp = 0
if x <= -0.0305:
tmp = (math.sqrt(((0.25 / math.hypot(1.0, x)) - (-0.5 + (-0.25 / math.hypot(1.0, x))))) / -2.0) + t_1
elif x <= 0.03:
tmp = ((-0.0859375 * math.pow(x, 4.0)) + (-0.056243896484375 * math.pow(x, 8.0))) + ((0.125 * math.pow(x, 2.0)) + (0.0673828125 * math.pow(x, 6.0)))
else:
tmp = t_0 + t_1
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 = Float64(sqrt(Float64(0.5 + Float64(0.5 / hypot(1.0, x)))) / -2.0)
t_1 = Float64(t_0 + 1.0)
tmp = 0.0
if (x <= -0.0305)
tmp = Float64(Float64(sqrt(Float64(Float64(0.25 / hypot(1.0, x)) - Float64(-0.5 + Float64(-0.25 / hypot(1.0, x))))) / -2.0) + t_1);
elseif (x <= 0.03)
tmp = Float64(Float64(Float64(-0.0859375 * (x ^ 4.0)) + Float64(-0.056243896484375 * (x ^ 8.0))) + Float64(Float64(0.125 * (x ^ 2.0)) + Float64(0.0673828125 * (x ^ 6.0))));
else
tmp = Float64(t_0 + t_1);
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 + (0.5 / hypot(1.0, x)))) / -2.0;
t_1 = t_0 + 1.0;
tmp = 0.0;
if (x <= -0.0305)
tmp = (sqrt(((0.25 / hypot(1.0, x)) - (-0.5 + (-0.25 / hypot(1.0, x))))) / -2.0) + t_1;
elseif (x <= 0.03)
tmp = ((-0.0859375 * (x ^ 4.0)) + (-0.056243896484375 * (x ^ 8.0))) + ((0.125 * (x ^ 2.0)) + (0.0673828125 * (x ^ 6.0)));
else
tmp = t_0 + t_1;
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[(N[Sqrt[N[(0.5 + N[(0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / -2.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, If[LessEqual[x, -0.0305], N[(N[(N[Sqrt[N[(N[(0.25 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] - N[(-0.5 + N[(-0.25 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / -2.0), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[x, 0.03], N[(N[(N[(-0.0859375 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(-0.056243896484375 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(0.125 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(0.0673828125 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + t$95$1), $MachinePrecision]]]]]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
↓
\begin{array}{l}
t_0 := \frac{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{-2}\\
t_1 := t_0 + 1\\
\mathbf{if}\;x \leq -0.0305:\\
\;\;\;\;\frac{\sqrt{\frac{0.25}{\mathsf{hypot}\left(1, x\right)} - \left(-0.5 + \frac{-0.25}{\mathsf{hypot}\left(1, x\right)}\right)}}{-2} + t_1\\
\mathbf{elif}\;x \leq 0.03:\\
\;\;\;\;\left(-0.0859375 \cdot {x}^{4} + -0.056243896484375 \cdot {x}^{8}\right) + \left(0.125 \cdot {x}^{2} + 0.0673828125 \cdot {x}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + t_1\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.1 |
|---|
| Cost | 40132 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 2:\\
\;\;\;\;\left(-0.0859375 \cdot {x}^{4} + -0.056243896484375 \cdot {x}^{8}\right) + \left(0.125 \cdot {x}^{2} + 0.0673828125 \cdot {x}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{-2} + \left(\frac{\sqrt{\frac{0.25}{\mathsf{hypot}\left(1, x\right)} - \left(-0.5 + \frac{-0.25}{\mathsf{hypot}\left(1, x\right)}\right)}}{-2} + 1\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.1 |
|---|
| Cost | 33668 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 2:\\
\;\;\;\;\left(-0.0859375 \cdot {x}^{4} + -0.056243896484375 \cdot {x}^{8}\right) + \left(0.125 \cdot {x}^{2} + 0.0673828125 \cdot {x}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{0.5 + \left(0.5 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}{2}}}{-2} + \left(\frac{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{-2} + 1\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.1 |
|---|
| Cost | 33412 |
|---|
\[\begin{array}{l}
t_0 := \frac{\sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{-2}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 2:\\
\;\;\;\;\left(-0.0859375 \cdot {x}^{4} + -0.056243896484375 \cdot {x}^{8}\right) + \left(0.125 \cdot {x}^{2} + 0.0673828125 \cdot {x}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(t_0 + 1\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.4 |
|---|
| Cost | 27080 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\mathbf{if}\;x \leq -0.031:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 1.02:\\
\;\;\;\;\left(-0.0859375 \cdot {x}^{4} + -0.056243896484375 \cdot {x}^{8}\right) + \left(0.125 \cdot {x}^{2} + 0.0673828125 \cdot {x}^{6}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{-2} + \left(\frac{\sqrt{0.5 + \frac{0.5}{x}}}{-2} + 1\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.4 |
|---|
| Cost | 20616 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\mathbf{if}\;x \leq -0.012:\\
\;\;\;\;1 - t_0\\
\mathbf{elif}\;x \leq 1.05:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{-2} + \left(\frac{\sqrt{0.5 + \frac{0.5}{x}}}{-2} + 1\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.4 |
|---|
| Cost | 20360 |
|---|
\[\begin{array}{l}
t_0 := \frac{\sqrt{0.5 + \frac{0.5}{x}}}{-2}\\
\mathbf{if}\;x \leq -0.012:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\mathbf{elif}\;x \leq 1.2:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(t_0 + 1\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.5 |
|---|
| Cost | 20100 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{1}{\mathsf{hypot}\left(1, x\right)} \leq 0.999995:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot {x}^{2} + -0.0859375 \cdot {x}^{4}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 0.8 |
|---|
| Cost | 19908 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1:\\
\;\;\;\;0.125 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 0.5 |
|---|
| Cost | 14152 |
|---|
\[\begin{array}{l}
t_0 := \frac{\sqrt{0.5 + \frac{0.5}{x}}}{-2}\\
\mathbf{if}\;x \leq -0.0023:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\mathbf{elif}\;x \leq 1.1:\\
\;\;\;\;0.125 \cdot {x}^{2} + -0.0859375 \cdot {x}^{4}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(t_0 + 1\right)\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 1.0 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;1 - \sqrt{0.5 - \frac{0.5}{x}}\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;0.125 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\left(-1 - \sqrt{0.5 + \frac{0.5}{x}}\right) + 2\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 1.2 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.55:\\
\;\;\;\;1 - \sqrt{0.5}\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;0.125 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{x}}\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 1.0 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;1 - \sqrt{0.5 - \frac{0.5}{x}}\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;0.125 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{x}}\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 1.5 |
|---|
| Cost | 6920 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
\mathbf{if}\;x \leq -1.55:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 1.5:\\
\;\;\;\;0.125 \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 16.4 |
|---|
| 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.15 \cdot 10^{-77}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 45.8 |
|---|
| Cost | 64 |
|---|
\[0
\]