\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\]
↓
\[\begin{array}{l}
t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.002:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(0.5 - t_0\right)}}{1 + \sqrt{0.5 + t_0}}\\
\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 (/ 0.5 (hypot 1.0 x))))
(if (<= (hypot 1.0 x) 1.002)
(+
(* 0.125 (pow x 2.0))
(+
(* 0.0673828125 (pow x 6.0))
(+ (* -0.056243896484375 (pow x 8.0)) (* -0.0859375 (pow x 4.0)))))
(/ (exp (log (- 0.5 t_0))) (+ 1.0 (sqrt (+ 0.5 t_0)))))))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 = 0.5 / hypot(1.0, x);
double tmp;
if (hypot(1.0, x) <= 1.002) {
tmp = (0.125 * pow(x, 2.0)) + ((0.0673828125 * pow(x, 6.0)) + ((-0.056243896484375 * pow(x, 8.0)) + (-0.0859375 * pow(x, 4.0))));
} else {
tmp = exp(log((0.5 - t_0))) / (1.0 + sqrt((0.5 + t_0)));
}
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 = 0.5 / Math.hypot(1.0, x);
double tmp;
if (Math.hypot(1.0, x) <= 1.002) {
tmp = (0.125 * Math.pow(x, 2.0)) + ((0.0673828125 * Math.pow(x, 6.0)) + ((-0.056243896484375 * Math.pow(x, 8.0)) + (-0.0859375 * Math.pow(x, 4.0))));
} else {
tmp = Math.exp(Math.log((0.5 - t_0))) / (1.0 + Math.sqrt((0.5 + t_0)));
}
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 = 0.5 / math.hypot(1.0, x)
tmp = 0
if math.hypot(1.0, x) <= 1.002:
tmp = (0.125 * math.pow(x, 2.0)) + ((0.0673828125 * math.pow(x, 6.0)) + ((-0.056243896484375 * math.pow(x, 8.0)) + (-0.0859375 * math.pow(x, 4.0))))
else:
tmp = math.exp(math.log((0.5 - t_0))) / (1.0 + math.sqrt((0.5 + t_0)))
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(0.5 / hypot(1.0, x))
tmp = 0.0
if (hypot(1.0, x) <= 1.002)
tmp = Float64(Float64(0.125 * (x ^ 2.0)) + Float64(Float64(0.0673828125 * (x ^ 6.0)) + Float64(Float64(-0.056243896484375 * (x ^ 8.0)) + Float64(-0.0859375 * (x ^ 4.0)))));
else
tmp = Float64(exp(log(Float64(0.5 - t_0))) / Float64(1.0 + sqrt(Float64(0.5 + t_0))));
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 = 0.5 / hypot(1.0, x);
tmp = 0.0;
if (hypot(1.0, x) <= 1.002)
tmp = (0.125 * (x ^ 2.0)) + ((0.0673828125 * (x ^ 6.0)) + ((-0.056243896484375 * (x ^ 8.0)) + (-0.0859375 * (x ^ 4.0))));
else
tmp = exp(log((0.5 - t_0))) / (1.0 + sqrt((0.5 + t_0)));
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[(0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision], 1.002], N[(N[(0.125 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.0673828125 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(N[(-0.056243896484375 * N[Power[x, 8.0], $MachinePrecision]), $MachinePrecision] + N[(-0.0859375 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[Log[N[(0.5 - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[(1.0 + N[Sqrt[N[(0.5 + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
↓
\begin{array}{l}
t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.002:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(0.5 - t_0\right)}}{1 + \sqrt{0.5 + t_0}}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.0 |
|---|
| Cost | 33412 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.002:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + \left(-0.056243896484375 \cdot {x}^{8} + -0.0859375 \cdot {x}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 - t_0}{1 + \sqrt{0.5 + t_0}}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.0 |
|---|
| Cost | 26756 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.002:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 - t_0}{1 + \sqrt{0.5 + t_0}}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.5 |
|---|
| Cost | 26692 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.002:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.5 |
|---|
| Cost | 26564 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.002:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \mathsf{fma}\left(x \cdot x, -0.0859375, 0.125\right), {x}^{6} \cdot 0.07275390625\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.5 |
|---|
| Cost | 19908 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.000002:\\
\;\;\;\;x \cdot \left(x \cdot \left(0.125 + -0.0859375 \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 0.7 |
|---|
| Cost | 7496 |
|---|
\[\begin{array}{l}
t_0 := 0.5 - \frac{0.5}{x}\\
\mathbf{if}\;x \leq -484.483050810706:\\
\;\;\;\;1 + \left(1 + \left(-1 - \sqrt{t_0}\right)\right)\\
\mathbf{elif}\;x \leq 0.571042581190123:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.0859375 \cdot \left(x \cdot x\right)\right) + 0.125 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 + \sqrt{0.5 + \frac{0.5}{x}}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 0.9 |
|---|
| Cost | 7236 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -484.483050810706:\\
\;\;\;\;1 + \left(1 + \left(-1 - \sqrt{0.5 - \frac{0.5}{x}}\right)\right)\\
\mathbf{elif}\;x \leq 0.571042581190123:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.0859375 \cdot \left(x \cdot x\right)\right) + 0.125 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{x}}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 0.9 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -484.483050810706:\\
\;\;\;\;1 - \sqrt{0.5 - \frac{0.5}{x}}\\
\mathbf{elif}\;x \leq 0.571042581190123:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.0859375 \cdot \left(x \cdot x\right)\right) + 0.125 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{x}}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 0.9 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5}{1 + \sqrt{0.5}}\\
\mathbf{if}\;x \leq -484.483050810706:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.571042581190123:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.0859375 \cdot \left(x \cdot x\right)\right) + 0.125 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 0.9 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -484.483050810706:\\
\;\;\;\;1 - \sqrt{0.5 - \frac{0.5}{x}}\\
\mathbf{elif}\;x \leq 0.571042581190123:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.0859375 \cdot \left(x \cdot x\right)\right) + 0.125 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 1.4 |
|---|
| Cost | 6856 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
\mathbf{if}\;x \leq -484.483050810706:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 0.571042581190123:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.0859375 \cdot \left(x \cdot x\right)\right) + 0.125 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 62.9 |
|---|
| Cost | 320 |
|---|
\[\frac{-4}{x \cdot x}
\]
| Alternative 13 |
|---|
| Error | 31.5 |
|---|
| Cost | 320 |
|---|
\[0.125 \cdot \left(x \cdot x\right)
\]