\[10^{-150} < \left|x\right| \land \left|x\right| < 10^{+150}\]
Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\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}\;p \leq 4.4 \cdot 10^{-10}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;p \leq 1.35 \cdot 10^{-203}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 7.2 \cdot 10^{-255}:\\
\;\;\;\;\frac{p}{x}\\
\mathbf{elif}\;p \leq 8 \cdot 10^{-284}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 3.3 \cdot 10^{-106}:\\
\;\;\;\;\frac{-p}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\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 (<= p 4.4e-10)
(sqrt 0.5)
(if (<= p 1.35e-203)
1.0
(if (<= p 7.2e-255)
(/ p x)
(if (<= p 8e-284) 1.0 (if (<= p 3.3e-106) (/ (- p) x) (sqrt 0.5))))))) 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 (p <= 4.4e-10) {
tmp = sqrt(0.5);
} else if (p <= 1.35e-203) {
tmp = 1.0;
} else if (p <= 7.2e-255) {
tmp = p / x;
} else if (p <= 8e-284) {
tmp = 1.0;
} else if (p <= 3.3e-106) {
tmp = -p / x;
} else {
tmp = sqrt(0.5);
}
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 (p <= 4.4d-10) then
tmp = sqrt(0.5d0)
else if (p <= 1.35d-203) then
tmp = 1.0d0
else if (p <= 7.2d-255) then
tmp = p / x
else if (p <= 8d-284) then
tmp = 1.0d0
else if (p <= 3.3d-106) then
tmp = -p / x
else
tmp = sqrt(0.5d0)
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 (p <= 4.4e-10) {
tmp = Math.sqrt(0.5);
} else if (p <= 1.35e-203) {
tmp = 1.0;
} else if (p <= 7.2e-255) {
tmp = p / x;
} else if (p <= 8e-284) {
tmp = 1.0;
} else if (p <= 3.3e-106) {
tmp = -p / x;
} else {
tmp = Math.sqrt(0.5);
}
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 p <= 4.4e-10:
tmp = math.sqrt(0.5)
elif p <= 1.35e-203:
tmp = 1.0
elif p <= 7.2e-255:
tmp = p / x
elif p <= 8e-284:
tmp = 1.0
elif p <= 3.3e-106:
tmp = -p / x
else:
tmp = math.sqrt(0.5)
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 (p <= 4.4e-10)
tmp = sqrt(0.5);
elseif (p <= 1.35e-203)
tmp = 1.0;
elseif (p <= 7.2e-255)
tmp = Float64(p / x);
elseif (p <= 8e-284)
tmp = 1.0;
elseif (p <= 3.3e-106)
tmp = Float64(Float64(-p) / x);
else
tmp = sqrt(0.5);
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 (p <= 4.4e-10)
tmp = sqrt(0.5);
elseif (p <= 1.35e-203)
tmp = 1.0;
elseif (p <= 7.2e-255)
tmp = p / x;
elseif (p <= 8e-284)
tmp = 1.0;
elseif (p <= 3.3e-106)
tmp = -p / x;
else
tmp = sqrt(0.5);
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[p, 4.4e-10], N[Sqrt[0.5], $MachinePrecision], If[LessEqual[p, 1.35e-203], 1.0, If[LessEqual[p, 7.2e-255], N[(p / x), $MachinePrecision], If[LessEqual[p, 8e-284], 1.0, If[LessEqual[p, 3.3e-106], N[((-p) / x), $MachinePrecision], N[Sqrt[0.5], $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}\;p \leq 4.4 \cdot 10^{-10}:\\
\;\;\;\;\sqrt{0.5}\\
\mathbf{elif}\;p \leq 1.35 \cdot 10^{-203}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 7.2 \cdot 10^{-255}:\\
\;\;\;\;\frac{p}{x}\\
\mathbf{elif}\;p \leq 8 \cdot 10^{-284}:\\
\;\;\;\;1\\
\mathbf{elif}\;p \leq 3.3 \cdot 10^{-106}:\\
\;\;\;\;\frac{-p}{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{0.5}\\
\end{array}