\[1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\]
↓
\[\begin{array}{l}
t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
t_1 := \mathsf{hypot}\left(1, {t_0}^{0.25}\right)\\
t_2 := \frac{0.5}{t_1}\\
t_3 := \frac{\frac{1}{\mathsf{hypot}\left(1, x\right)}}{t_1}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0005:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{0.5}{1 + \sqrt{t_0}}, t_3 \cdot \frac{-0.5}{t_1}\right) + \mathsf{fma}\left(\frac{\frac{-1}{\mathsf{hypot}\left(1, x\right)}}{t_1}, t_2, t_3 \cdot t_2\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 (+ 0.5 (/ 0.5 (hypot 1.0 x))))
(t_1 (hypot 1.0 (pow t_0 0.25)))
(t_2 (/ 0.5 t_1))
(t_3 (/ (/ 1.0 (hypot 1.0 x)) t_1)))
(if (<= (hypot 1.0 x) 1.0005)
(+
(* 0.125 (pow x 2.0))
(+ (* 0.0673828125 (pow x 6.0)) (* -0.0859375 (pow x 4.0))))
(+
(fma 1.0 (/ 0.5 (+ 1.0 (sqrt t_0))) (* t_3 (/ -0.5 t_1)))
(fma (/ (/ -1.0 (hypot 1.0 x)) t_1) t_2 (* t_3 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 = 0.5 + (0.5 / hypot(1.0, x));
double t_1 = hypot(1.0, pow(t_0, 0.25));
double t_2 = 0.5 / t_1;
double t_3 = (1.0 / hypot(1.0, x)) / t_1;
double tmp;
if (hypot(1.0, x) <= 1.0005) {
tmp = (0.125 * pow(x, 2.0)) + ((0.0673828125 * pow(x, 6.0)) + (-0.0859375 * pow(x, 4.0)));
} else {
tmp = fma(1.0, (0.5 / (1.0 + sqrt(t_0))), (t_3 * (-0.5 / t_1))) + fma(((-1.0 / hypot(1.0, x)) / t_1), t_2, (t_3 * 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 = Float64(0.5 + Float64(0.5 / hypot(1.0, x)))
t_1 = hypot(1.0, (t_0 ^ 0.25))
t_2 = Float64(0.5 / t_1)
t_3 = Float64(Float64(1.0 / hypot(1.0, x)) / t_1)
tmp = 0.0
if (hypot(1.0, x) <= 1.0005)
tmp = Float64(Float64(0.125 * (x ^ 2.0)) + Float64(Float64(0.0673828125 * (x ^ 6.0)) + Float64(-0.0859375 * (x ^ 4.0))));
else
tmp = Float64(fma(1.0, Float64(0.5 / Float64(1.0 + sqrt(t_0))), Float64(t_3 * Float64(-0.5 / t_1))) + fma(Float64(Float64(-1.0 / hypot(1.0, x)) / t_1), t_2, Float64(t_3 * t_2)));
end
return 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[(0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[1.0 ^ 2 + N[Power[t$95$0, 0.25], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$2 = N[(0.5 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision], 1.0005], N[(N[(0.125 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.0673828125 * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(-0.0859375 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 * N[(0.5 / N[(1.0 + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * N[(-0.5 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * t$95$2 + N[(t$95$3 * 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 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
t_1 := \mathsf{hypot}\left(1, {t_0}^{0.25}\right)\\
t_2 := \frac{0.5}{t_1}\\
t_3 := \frac{\frac{1}{\mathsf{hypot}\left(1, x\right)}}{t_1}\\
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0005:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1, \frac{0.5}{1 + \sqrt{t_0}}, t_3 \cdot \frac{-0.5}{t_1}\right) + \mathsf{fma}\left(\frac{\frac{-1}{\mathsf{hypot}\left(1, x\right)}}{t_1}, t_2, t_3 \cdot t_2\right)\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 0.0 |
|---|
| Cost | 46532 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0005:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{\mathsf{fma}\left({\left(\frac{0.25}{1 + x \cdot x}\right)}^{0.3333333333333333}, \sqrt[3]{\frac{-0.5}{\mathsf{hypot}\left(1, x\right)}}, 0.5\right)}}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.0 |
|---|
| Cost | 39684 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0005:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{e^{\log \left(0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}\right)}}}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 0.3 |
|---|
| Cost | 33092 |
|---|
\[\begin{array}{l}
t_0 := 0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}\\
t_1 := 1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\mathbf{if}\;x \leq -0.03901317679118908:\\
\;\;\;\;\frac{e^{\log t_0}}{t_1}\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t_1}{t_0}}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 0.0 |
|---|
| Cost | 26884 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0005:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}{0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.0 |
|---|
| Cost | 26756 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\mathsf{hypot}\left(1, x\right) \leq 1.0005:\\
\;\;\;\;0.125 \cdot {x}^{2} + \left(0.0673828125 \cdot {x}^{6} + -0.0859375 \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 1.0 |
|---|
| Cost | 20360 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;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 7 |
|---|
| Error | 1.3 |
|---|
| Cost | 13576 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5}{1 + \sqrt{0.5}}\\
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, -0.0859375, 0.125 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 1.0 |
|---|
| Cost | 13576 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;\frac{0.5}{1 + \sqrt{0.5}}\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, -0.0859375, 0.125 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 - \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 1.3 |
|---|
| Cost | 7240 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5}{1 + \sqrt{0.5}}\\
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \mathsf{fma}\left(x, x \cdot -0.0859375, 0.125\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 1.4 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
t_0 := \frac{0.5}{1 + \sqrt{0.5}}\\
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(x \cdot 0.125\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 1.9 |
|---|
| Cost | 6856 |
|---|
\[\begin{array}{l}
t_0 := 1 - \sqrt{0.5}\\
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(x \cdot 0.125\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 26.5 |
|---|
| Cost | 584 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -47137.75285091917:\\
\;\;\;\;0.18181818181818182\\
\mathbf{elif}\;x \leq 6.820343214013506 \cdot 10^{-11}:\\
\;\;\;\;x \cdot \left(x \cdot 0.125\right)\\
\mathbf{else}:\\
\;\;\;\;0.18181818181818182\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 26.3 |
|---|
| Cost | 576 |
|---|
\[\frac{1}{5.5 + \frac{8}{x \cdot x}}
\]
| Alternative 14 |
|---|
| Error | 56.4 |
|---|
| Cost | 64 |
|---|
\[0.18181818181818182
\]