\[10^{-150} < \left|x\right| \land \left|x\right| < 10^{+150}\]
\[\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;\frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}} \leq -1:\\
\;\;\;\;\sqrt{2} \cdot \left(-\frac{-p}{\frac{-1}{\frac{\sqrt{0.5}}{x}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{\frac{2}{\sqrt{p \cdot \left(p \cdot 4\right) + x \cdot x}}}{\frac{4}{x}}}\\
\end{array}
\]
(FPCore (p x)
:precision binary64
(sqrt (* 0.5 (+ 1.0 (/ x (sqrt (+ (* (* 4.0 p) p) (* x x))))))))
↓
(FPCore (p x)
:precision binary64
(if (<= (/ x (sqrt (+ (* (* 4.0 p) p) (* x x)))) -1.0)
(* (sqrt 2.0) (- (/ (- p) (/ -1.0 (/ (sqrt 0.5) x)))))
(sqrt (+ 0.5 (/ (/ 2.0 (sqrt (+ (* p (* p 4.0)) (* x x)))) (/ 4.0 x))))))
double code(double p, double x) {
return sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
}
↓
double code(double p, double x) {
double tmp;
if ((x / sqrt((((4.0 * p) * p) + (x * x)))) <= -1.0) {
tmp = sqrt(2.0) * -(-p / (-1.0 / (sqrt(0.5) / x)));
} else {
tmp = sqrt((0.5 + ((2.0 / sqrt(((p * (p * 4.0)) + (x * x)))) / (4.0 / x))));
}
return tmp;
}
real(8) function code(p, x)
real(8), intent (in) :: p
real(8), intent (in) :: x
code = sqrt((0.5d0 * (1.0d0 + (x / sqrt((((4.0d0 * p) * p) + (x * x)))))))
end function
↓
real(8) function code(p, x)
real(8), intent (in) :: p
real(8), intent (in) :: x
real(8) :: tmp
if ((x / sqrt((((4.0d0 * p) * p) + (x * x)))) <= (-1.0d0)) then
tmp = sqrt(2.0d0) * -(-p / ((-1.0d0) / (sqrt(0.5d0) / x)))
else
tmp = sqrt((0.5d0 + ((2.0d0 / sqrt(((p * (p * 4.0d0)) + (x * x)))) / (4.0d0 / x))))
end if
code = tmp
end function
public static double code(double p, double x) {
return Math.sqrt((0.5 * (1.0 + (x / Math.sqrt((((4.0 * p) * p) + (x * x)))))));
}
↓
public static double code(double p, double x) {
double tmp;
if ((x / Math.sqrt((((4.0 * p) * p) + (x * x)))) <= -1.0) {
tmp = Math.sqrt(2.0) * -(-p / (-1.0 / (Math.sqrt(0.5) / x)));
} else {
tmp = Math.sqrt((0.5 + ((2.0 / Math.sqrt(((p * (p * 4.0)) + (x * x)))) / (4.0 / x))));
}
return tmp;
}
def code(p, x):
return math.sqrt((0.5 * (1.0 + (x / math.sqrt((((4.0 * p) * p) + (x * x)))))))
↓
def code(p, x):
tmp = 0
if (x / math.sqrt((((4.0 * p) * p) + (x * x)))) <= -1.0:
tmp = math.sqrt(2.0) * -(-p / (-1.0 / (math.sqrt(0.5) / x)))
else:
tmp = math.sqrt((0.5 + ((2.0 / math.sqrt(((p * (p * 4.0)) + (x * x)))) / (4.0 / x))))
return tmp
function code(p, x)
return sqrt(Float64(0.5 * Float64(1.0 + Float64(x / sqrt(Float64(Float64(Float64(4.0 * p) * p) + Float64(x * x)))))))
end
↓
function code(p, x)
tmp = 0.0
if (Float64(x / sqrt(Float64(Float64(Float64(4.0 * p) * p) + Float64(x * x)))) <= -1.0)
tmp = Float64(sqrt(2.0) * Float64(-Float64(Float64(-p) / Float64(-1.0 / Float64(sqrt(0.5) / x)))));
else
tmp = sqrt(Float64(0.5 + Float64(Float64(2.0 / sqrt(Float64(Float64(p * Float64(p * 4.0)) + Float64(x * x)))) / Float64(4.0 / x))));
end
return tmp
end
function tmp = code(p, x)
tmp = sqrt((0.5 * (1.0 + (x / sqrt((((4.0 * p) * p) + (x * x)))))));
end
↓
function tmp_2 = code(p, x)
tmp = 0.0;
if ((x / sqrt((((4.0 * p) * p) + (x * x)))) <= -1.0)
tmp = sqrt(2.0) * -(-p / (-1.0 / (sqrt(0.5) / x)));
else
tmp = sqrt((0.5 + ((2.0 / sqrt(((p * (p * 4.0)) + (x * x)))) / (4.0 / x))));
end
tmp_2 = tmp;
end
code[p_, x_] := N[Sqrt[N[(0.5 * N[(1.0 + N[(x / N[Sqrt[N[(N[(N[(4.0 * p), $MachinePrecision] * p), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
↓
code[p_, x_] := If[LessEqual[N[(x / N[Sqrt[N[(N[(N[(4.0 * p), $MachinePrecision] * p), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[((-p) / N[(-1.0 / N[(N[Sqrt[0.5], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[Sqrt[N[(0.5 + N[(N[(2.0 / N[Sqrt[N[(N[(p * N[(p * 4.0), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(4.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}
↓
\begin{array}{l}
\mathbf{if}\;\frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}} \leq -1:\\
\;\;\;\;\sqrt{2} \cdot \left(-\frac{-p}{\frac{-1}{\frac{\sqrt{0.5}}{x}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{\frac{2}{\sqrt{p \cdot \left(p \cdot 4\right) + x \cdot x}}}{\frac{4}{x}}}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 7.1 |
|---|
| Cost | 20932 |
|---|
\[\begin{array}{l}
t_0 := \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\\
\mathbf{if}\;t_0 \leq -1:\\
\;\;\;\;\sqrt{2} \cdot \left(-\frac{-p}{\frac{-1}{\frac{\sqrt{0.5}}{x}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 \cdot \left(1 + t_0\right)}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 7.1 |
|---|
| Cost | 20932 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}} \leq -1:\\
\;\;\;\;\sqrt{2} \cdot \left(-\frac{-p}{\frac{-1}{\frac{\sqrt{0.5}}{x}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{\frac{\sqrt{p \cdot \left(p \cdot 4\right) + x \cdot x}}{x}}}\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 16.8 |
|---|
| Cost | 14224 |
|---|
\[\begin{array}{l}
t_0 := \sqrt{0.5 \cdot \left(1 + \frac{x}{2 \cdot \frac{{p}^{2}}{x} + x}\right)}\\
t_1 := \sqrt{0.5} \cdot p\\
\mathbf{if}\;p \leq -5.7 \cdot 10^{-275}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;p \leq 8.8 \cdot 10^{-252}:\\
\;\;\;\;-1 \cdot \frac{\sqrt{2} \cdot t_1}{x}\\
\mathbf{elif}\;p \leq 5.2 \cdot 10^{-72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;p \leq 1.45 \cdot 10^{-49}:\\
\;\;\;\;t_1 \cdot \left(-\frac{\sqrt{2}}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 20.5 |
|---|
| Cost | 13772 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -1.35 \cdot 10^{-38}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{-0.25 \cdot \frac{x}{p} + -2 \cdot \frac{p}{x}}}\\
\mathbf{elif}\;p \leq -8.8 \cdot 10^{-275}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 2.2 \cdot 10^{-253}:\\
\;\;\;\;-1 \cdot \frac{\sqrt{2} \cdot \left(\sqrt{0.5} \cdot p\right)}{x}\\
\mathbf{elif}\;p \leq 4 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{2 \cdot \frac{p}{x} + 0.25 \cdot \frac{x}{p}}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 20.4 |
|---|
| Cost | 13708 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -6 \cdot 10^{-44}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{-0.25 \cdot \frac{x}{p} + -2 \cdot \frac{p}{x}}}\\
\mathbf{elif}\;p \leq -4.8 \cdot 10^{-275}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 2.95 \cdot 10^{-254}:\\
\;\;\;\;-\sqrt{2} \cdot \frac{p \cdot \sqrt{0.5}}{x}\\
\mathbf{elif}\;p \leq 1.05 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{2 \cdot \frac{p}{x} + 0.25 \cdot \frac{x}{p}}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 20.5 |
|---|
| Cost | 13708 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -1.9 \cdot 10^{-36}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{-0.25 \cdot \frac{x}{p} + -2 \cdot \frac{p}{x}}}\\
\mathbf{elif}\;p \leq -4 \cdot 10^{-275}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 8.2 \cdot 10^{-254}:\\
\;\;\;\;\left(\sqrt{0.5} \cdot p\right) \cdot \left(-\frac{\sqrt{2}}{x}\right)\\
\mathbf{elif}\;p \leq 3.9 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{2 \cdot \frac{p}{x} + 0.25 \cdot \frac{x}{p}}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 20.5 |
|---|
| Cost | 7888 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -1.5 \cdot 10^{-43}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{-0.25 \cdot \frac{x}{p} + -2 \cdot \frac{p}{x}}}\\
\mathbf{elif}\;p \leq -1.95 \cdot 10^{-274}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 3.5 \cdot 10^{-301}:\\
\;\;\;\;\sqrt{0}\\
\mathbf{elif}\;p \leq 3.5 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{2 \cdot \frac{p}{x} + 0.25 \cdot \frac{x}{p}}}\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 20.7 |
|---|
| Cost | 7492 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -3.8 \cdot 10^{-41}:\\
\;\;\;\;\sqrt{0.5 + \frac{0.5}{-0.25 \cdot \frac{x}{p} + -2 \cdot \frac{p}{x}}}\\
\mathbf{elif}\;p \leq -8.8 \cdot 10^{-275}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 1.9 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{0}\\
\mathbf{elif}\;p \leq 4 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 20.9 |
|---|
| Cost | 6992 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -3 \cdot 10^{-40}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;p \leq -8.8 \cdot 10^{-275}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 4.5 \cdot 10^{-301}:\\
\;\;\;\;\sqrt{0}\\
\mathbf{elif}\;p \leq 3 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 20.3 |
|---|
| Cost | 6728 |
|---|
\[\begin{array}{l}
\mathbf{if}\;p \leq -4.4 \cdot 10^{-41}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;p \leq 3.8 \cdot 10^{-91}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 28.7 |
|---|
| Cost | 6464 |
|---|
\[\sqrt{0.5}
\]