\[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} + re\right)}
\]
↓
\[\begin{array}{l}
t_0 := \log \left(\frac{-1}{re}\right)\\
t_1 := 0.5 \cdot {\left(e^{0.25 \cdot \left(\log \left({im}^{2}\right) + t_0\right)}\right)}^{2}\\
t_2 := 0.5 \cdot \sqrt{2 \cdot \left(re + \mathsf{hypot}\left(re, im\right)\right)}\\
\mathbf{if}\;re \leq -1.65 \cdot 10^{+263}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq -2.05 \cdot 10^{+257}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;re \leq -2.15 \cdot 10^{+155}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq -1.85 \cdot 10^{+136}:\\
\;\;\;\;0.5 \cdot e^{0.5 \cdot t_0 - \log \left(\frac{-1}{im}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
(FPCore (re im)
:precision binary64
(* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
↓
(FPCore (re im)
:precision binary64
(let* ((t_0 (log (/ -1.0 re)))
(t_1 (* 0.5 (pow (exp (* 0.25 (+ (log (pow im 2.0)) t_0))) 2.0)))
(t_2 (* 0.5 (sqrt (* 2.0 (+ re (hypot re im)))))))
(if (<= re -1.65e+263)
t_1
(if (<= re -2.05e+257)
t_2
(if (<= re -2.15e+155)
t_1
(if (<= re -1.85e+136)
(* 0.5 (exp (- (* 0.5 t_0) (log (/ -1.0 im)))))
t_2))))))double code(double re, double im) {
return 0.5 * sqrt((2.0 * (sqrt(((re * re) + (im * im))) + re)));
}
↓
double code(double re, double im) {
double t_0 = log((-1.0 / re));
double t_1 = 0.5 * pow(exp((0.25 * (log(pow(im, 2.0)) + t_0))), 2.0);
double t_2 = 0.5 * sqrt((2.0 * (re + hypot(re, im))));
double tmp;
if (re <= -1.65e+263) {
tmp = t_1;
} else if (re <= -2.05e+257) {
tmp = t_2;
} else if (re <= -2.15e+155) {
tmp = t_1;
} else if (re <= -1.85e+136) {
tmp = 0.5 * exp(((0.5 * t_0) - log((-1.0 / im))));
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double re, double im) {
return 0.5 * Math.sqrt((2.0 * (Math.sqrt(((re * re) + (im * im))) + re)));
}
↓
public static double code(double re, double im) {
double t_0 = Math.log((-1.0 / re));
double t_1 = 0.5 * Math.pow(Math.exp((0.25 * (Math.log(Math.pow(im, 2.0)) + t_0))), 2.0);
double t_2 = 0.5 * Math.sqrt((2.0 * (re + Math.hypot(re, im))));
double tmp;
if (re <= -1.65e+263) {
tmp = t_1;
} else if (re <= -2.05e+257) {
tmp = t_2;
} else if (re <= -2.15e+155) {
tmp = t_1;
} else if (re <= -1.85e+136) {
tmp = 0.5 * Math.exp(((0.5 * t_0) - Math.log((-1.0 / im))));
} else {
tmp = t_2;
}
return tmp;
}
def code(re, im):
return 0.5 * math.sqrt((2.0 * (math.sqrt(((re * re) + (im * im))) + re)))
↓
def code(re, im):
t_0 = math.log((-1.0 / re))
t_1 = 0.5 * math.pow(math.exp((0.25 * (math.log(math.pow(im, 2.0)) + t_0))), 2.0)
t_2 = 0.5 * math.sqrt((2.0 * (re + math.hypot(re, im))))
tmp = 0
if re <= -1.65e+263:
tmp = t_1
elif re <= -2.05e+257:
tmp = t_2
elif re <= -2.15e+155:
tmp = t_1
elif re <= -1.85e+136:
tmp = 0.5 * math.exp(((0.5 * t_0) - math.log((-1.0 / im))))
else:
tmp = t_2
return tmp
function code(re, im)
return Float64(0.5 * sqrt(Float64(2.0 * Float64(sqrt(Float64(Float64(re * re) + Float64(im * im))) + re))))
end
↓
function code(re, im)
t_0 = log(Float64(-1.0 / re))
t_1 = Float64(0.5 * (exp(Float64(0.25 * Float64(log((im ^ 2.0)) + t_0))) ^ 2.0))
t_2 = Float64(0.5 * sqrt(Float64(2.0 * Float64(re + hypot(re, im)))))
tmp = 0.0
if (re <= -1.65e+263)
tmp = t_1;
elseif (re <= -2.05e+257)
tmp = t_2;
elseif (re <= -2.15e+155)
tmp = t_1;
elseif (re <= -1.85e+136)
tmp = Float64(0.5 * exp(Float64(Float64(0.5 * t_0) - log(Float64(-1.0 / im)))));
else
tmp = t_2;
end
return tmp
end
function tmp = code(re, im)
tmp = 0.5 * sqrt((2.0 * (sqrt(((re * re) + (im * im))) + re)));
end
↓
function tmp_2 = code(re, im)
t_0 = log((-1.0 / re));
t_1 = 0.5 * (exp((0.25 * (log((im ^ 2.0)) + t_0))) ^ 2.0);
t_2 = 0.5 * sqrt((2.0 * (re + hypot(re, im))));
tmp = 0.0;
if (re <= -1.65e+263)
tmp = t_1;
elseif (re <= -2.05e+257)
tmp = t_2;
elseif (re <= -2.15e+155)
tmp = t_1;
elseif (re <= -1.85e+136)
tmp = 0.5 * exp(((0.5 * t_0) - log((-1.0 / im))));
else
tmp = t_2;
end
tmp_2 = tmp;
end
code[re_, im_] := N[(0.5 * N[Sqrt[N[(2.0 * N[(N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[re_, im_] := Block[{t$95$0 = N[Log[N[(-1.0 / re), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[Power[im, 2.0], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[Sqrt[N[(2.0 * N[(re + N[Sqrt[re ^ 2 + im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -1.65e+263], t$95$1, If[LessEqual[re, -2.05e+257], t$95$2, If[LessEqual[re, -2.15e+155], t$95$1, If[LessEqual[re, -1.85e+136], N[(0.5 * N[Exp[N[(N[(0.5 * t$95$0), $MachinePrecision] - N[Log[N[(-1.0 / im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} + re\right)}
↓
\begin{array}{l}
t_0 := \log \left(\frac{-1}{re}\right)\\
t_1 := 0.5 \cdot {\left(e^{0.25 \cdot \left(\log \left({im}^{2}\right) + t_0\right)}\right)}^{2}\\
t_2 := 0.5 \cdot \sqrt{2 \cdot \left(re + \mathsf{hypot}\left(re, im\right)\right)}\\
\mathbf{if}\;re \leq -1.65 \cdot 10^{+263}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq -2.05 \cdot 10^{+257}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;re \leq -2.15 \cdot 10^{+155}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;re \leq -1.85 \cdot 10^{+136}:\\
\;\;\;\;0.5 \cdot e^{0.5 \cdot t_0 - \log \left(\frac{-1}{im}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Accuracy | 85.3% |
|---|
| Cost | 26884 |
|---|
\[\begin{array}{l}
\mathbf{if}\;\sqrt{2 \cdot \left(re + \sqrt{re \cdot re + im \cdot im}\right)} \leq 0:\\
\;\;\;\;\sqrt{im \cdot \left(\frac{im}{re} \cdot -0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re + \mathsf{hypot}\left(re, im\right)\right)}\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 58.3% |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -3.25 \cdot 10^{-192}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(-im\right)}\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{-42}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re + im\right)}\\
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 31.5% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.6 \cdot 10^{-151}:\\
\;\;\;\;3812798742493.5\\
\mathbf{elif}\;im \leq 2.9 \cdot 10^{-230}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 43.9% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -5.7 \cdot 10^{+85}:\\
\;\;\;\;0\\
\mathbf{elif}\;re \leq 3.6 \cdot 10^{-209}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 57.9% |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -3.2 \cdot 10^{-193}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(-im\right)}\\
\mathbf{elif}\;im \leq 6.5 \cdot 10^{-42}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 8.8% |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.55 \cdot 10^{-151}:\\
\;\;\;\;193710244.5\\
\mathbf{elif}\;im \leq 4.1 \cdot 10^{-224}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.006944444444444444\\
\end{array}
\]
| Alternative 7 |
|---|
| Accuracy | 8.8% |
|---|
| Cost | 328 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.8 \cdot 10^{-151}:\\
\;\;\;\;3812798742493.5\\
\mathbf{elif}\;im \leq 5 \cdot 10^{-223}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.006944444444444444\\
\end{array}
\]
| Alternative 8 |
|---|
| Accuracy | 8.8% |
|---|
| Cost | 196 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -6.5 \cdot 10^{+45}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;4.923200210024256 \cdot 10^{-15}\\
\end{array}
\]
| Alternative 9 |
|---|
| Accuracy | 8.8% |
|---|
| Cost | 196 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -5.5 \cdot 10^{+46}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;4.96145150637606 \cdot 10^{-8}\\
\end{array}
\]
| Alternative 10 |
|---|
| Accuracy | 8.9% |
|---|
| Cost | 196 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -1.9 \cdot 10^{+47}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1.071673525377229 \cdot 10^{-5}\\
\end{array}
\]
| Alternative 11 |
|---|
| Accuracy | 8.9% |
|---|
| Cost | 196 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -8.2 \cdot 10^{+45}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.006944444444444444\\
\end{array}
\]
| Alternative 12 |
|---|
| Accuracy | 6.1% |
|---|
| Cost | 64 |
|---|
\[0
\]