\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
\]
↓
\[\log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{-2}}\right)}\right)
\]
(FPCore (re im)
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10.0)))
↓
(FPCore (re im)
:precision binary64
(log (pow (hypot re im) (sqrt (pow (log 10.0) -2.0)))))
double code(double re, double im) {
return log(sqrt(((re * re) + (im * im)))) / log(10.0);
}
↓
double code(double re, double im) {
return log(pow(hypot(re, im), sqrt(pow(log(10.0), -2.0))));
}
public static double code(double re, double im) {
return Math.log(Math.sqrt(((re * re) + (im * im)))) / Math.log(10.0);
}
↓
public static double code(double re, double im) {
return Math.log(Math.pow(Math.hypot(re, im), Math.sqrt(Math.pow(Math.log(10.0), -2.0))));
}
def code(re, im):
return math.log(math.sqrt(((re * re) + (im * im)))) / math.log(10.0)
↓
def code(re, im):
return math.log(math.pow(math.hypot(re, im), math.sqrt(math.pow(math.log(10.0), -2.0))))
function code(re, im)
return Float64(log(sqrt(Float64(Float64(re * re) + Float64(im * im)))) / log(10.0))
end
↓
function code(re, im)
return log((hypot(re, im) ^ sqrt((log(10.0) ^ -2.0))))
end
function tmp = code(re, im)
tmp = log(sqrt(((re * re) + (im * im)))) / log(10.0);
end
↓
function tmp = code(re, im)
tmp = log((hypot(re, im) ^ sqrt((log(10.0) ^ -2.0))));
end
code[re_, im_] := N[(N[Log[N[Sqrt[N[(N[(re * re), $MachinePrecision] + N[(im * im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Log[10.0], $MachinePrecision]), $MachinePrecision]
↓
code[re_, im_] := N[Log[N[Power[N[Sqrt[re ^ 2 + im ^ 2], $MachinePrecision], N[Sqrt[N[Power[N[Log[10.0], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}
↓
\log \left({\left(\mathsf{hypot}\left(re, im\right)\right)}^{\left(\sqrt{{\log 10}^{-2}}\right)}\right)
Alternatives
| Alternative 1 |
|---|
| Accuracy | 42.5% |
|---|
| Cost | 19852 |
|---|
\[\begin{array}{l}
t_0 := \frac{-\log \left(\frac{-1}{re}\right)}{\log 10}\\
\mathbf{if}\;re \leq -2.6 \cdot 10^{-23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq -1.5 \cdot 10^{-143}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\mathbf{elif}\;re \leq -4.2 \cdot 10^{-215}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\log \left({im}^{\left(\frac{-1}{\log 0.1}\right)}\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 99.1% |
|---|
| Cost | 19456 |
|---|
\[\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log 10}
\]
| Alternative 3 |
|---|
| Accuracy | 42.5% |
|---|
| Cost | 13580 |
|---|
\[\begin{array}{l}
t_0 := \frac{-\log \left(\frac{-1}{re}\right)}{\log 10}\\
\mathbf{if}\;re \leq -3.1 \cdot 10^{-23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq -4.8 \cdot 10^{-144}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\mathbf{elif}\;re \leq -4 \cdot 10^{-215}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-\frac{\log im}{\log 0.1}\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 42.5% |
|---|
| Cost | 13516 |
|---|
\[\begin{array}{l}
t_0 := \frac{\log \left(\frac{-1}{re}\right)}{\log 0.1}\\
\mathbf{if}\;re \leq -2.85 \cdot 10^{-23}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;re \leq -3.5 \cdot 10^{-144}:\\
\;\;\;\;\frac{\log im}{\log 10}\\
\mathbf{elif}\;re \leq -4.2 \cdot 10^{-215}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-\frac{\log im}{\log 0.1}\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 3.1% |
|---|
| Cost | 12992 |
|---|
\[\frac{\log im}{\log 0.1}
\]
| Alternative 6 |
|---|
| Accuracy | 27.3% |
|---|
| Cost | 12992 |
|---|
\[\frac{\log im}{\log 10}
\]