\[0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} + re\right)}
\]
↓
\[\begin{array}{l}
\mathbf{if}\;re \leq -2.847260330845642 \cdot 10^{+135}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot \frac{-im}{re}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re + \mathsf{hypot}\left(re, im\right)\right)}\\
\end{array}
\]
(FPCore (re im)
:precision binary64
(* 0.5 (sqrt (* 2.0 (+ (sqrt (+ (* re re) (* im im))) re)))))
↓
(FPCore (re im)
:precision binary64
(if (<= re -2.847260330845642e+135)
(* 0.5 (sqrt (* im (/ (- im) re))))
(* 0.5 (sqrt (* 2.0 (+ re (hypot re im)))))))
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 tmp;
if (re <= -2.847260330845642e+135) {
tmp = 0.5 * sqrt((im * (-im / re)));
} else {
tmp = 0.5 * sqrt((2.0 * (re + hypot(re, im))));
}
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 tmp;
if (re <= -2.847260330845642e+135) {
tmp = 0.5 * Math.sqrt((im * (-im / re)));
} else {
tmp = 0.5 * Math.sqrt((2.0 * (re + Math.hypot(re, im))));
}
return tmp;
}
def code(re, im):
return 0.5 * math.sqrt((2.0 * (math.sqrt(((re * re) + (im * im))) + re)))
↓
def code(re, im):
tmp = 0
if re <= -2.847260330845642e+135:
tmp = 0.5 * math.sqrt((im * (-im / re)))
else:
tmp = 0.5 * math.sqrt((2.0 * (re + math.hypot(re, im))))
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)
tmp = 0.0
if (re <= -2.847260330845642e+135)
tmp = Float64(0.5 * sqrt(Float64(im * Float64(Float64(-im) / re))));
else
tmp = Float64(0.5 * sqrt(Float64(2.0 * Float64(re + hypot(re, im)))));
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)
tmp = 0.0;
if (re <= -2.847260330845642e+135)
tmp = 0.5 * sqrt((im * (-im / re)));
else
tmp = 0.5 * sqrt((2.0 * (re + hypot(re, im))));
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_] := If[LessEqual[re, -2.847260330845642e+135], N[(0.5 * N[Sqrt[N[(im * N[((-im) / re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(2.0 * N[(re + N[Sqrt[re ^ 2 + im ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
0.5 \cdot \sqrt{2 \cdot \left(\sqrt{re \cdot re + im \cdot im} + re\right)}
↓
\begin{array}{l}
\mathbf{if}\;re \leq -2.847260330845642 \cdot 10^{+135}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot \frac{-im}{re}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re + \mathsf{hypot}\left(re, im\right)\right)}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 25.3 |
|---|
| Cost | 7112 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.0163854006903912 \cdot 10^{-153}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re - im\right)}\\
\mathbf{elif}\;im \leq 7.451017496197032 \cdot 10^{-172}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re + im\right)}\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 35.6 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -4.527678248565426 \cdot 10^{+119}:\\
\;\;\;\;0.5 \cdot \left(4 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 2.3081656146401523 \cdot 10^{-154}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 26.0 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.0163854006903912 \cdot 10^{-153}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot -2}\\
\mathbf{elif}\;im \leq 7.451017496197032 \cdot 10^{-172}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 25.7 |
|---|
| Cost | 6984 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.0163854006903912 \cdot 10^{-153}:\\
\;\;\;\;0.5 \cdot \sqrt{2 \cdot \left(re - im\right)}\\
\mathbf{elif}\;im \leq 7.451017496197032 \cdot 10^{-172}:\\
\;\;\;\;0.5 \cdot \left(2 \cdot \sqrt{re}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 44.6 |
|---|
| Cost | 6852 |
|---|
\[\begin{array}{l}
\mathbf{if}\;im \leq 1.2106728087571633 \cdot 10^{-223}:\\
\;\;\;\;0.5 \cdot \left(4 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{im \cdot 2}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 58.3 |
|---|
| Cost | 6596 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -3.6162986755564866 \cdot 10^{+76}:\\
\;\;\;\;0.5 \cdot \left(4 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|im\right|\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 59.7 |
|---|
| Cost | 448 |
|---|
\[0.5 \cdot \left(4 \cdot \left(im \cdot im\right)\right)
\]
| Alternative 8 |
|---|
| Error | 61.3 |
|---|
| Cost | 64 |
|---|
\[im
\]
| Alternative 9 |
|---|
| Error | 60.2 |
|---|
| Cost | 64 |
|---|
\[0
\]