\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\begin{array}{l}
\mathbf{if}\;re \le -2.51549872314573077 \cdot 10^{88}:\\
\;\;\;\;\frac{1}{\sqrt{\log 10}} \cdot \left(-1 \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \sqrt{\frac{1}{\log 10}}\right)\right)\\
\mathbf{elif}\;re \le -1.66094686593226559 \cdot 10^{-174}:\\
\;\;\;\;\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\sqrt{re \cdot re + im \cdot im}\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\\
\mathbf{elif}\;re \le 3.7706602894998885 \cdot 10^{-238}:\\
\;\;\;\;\frac{1}{\sqrt{\log 10}} \cdot \log \left({im}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\\
\mathbf{elif}\;re \le 2.4617813008158136 \cdot 10^{77}:\\
\;\;\;\;\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\sqrt{re \cdot re + im \cdot im}\right)}^{\left(\frac{1}{\sqrt{\log 10}}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\log 10}} \cdot \log \left({\left(\frac{1}{re}\right)}^{\left(-\sqrt{\frac{1}{\log 10}}\right)}\right)\\
\end{array}double code(double re, double im) {
return (log(sqrt(((re * re) + (im * im)))) / log(10.0));
}
double code(double re, double im) {
double temp;
if ((re <= -2.5154987231457308e+88)) {
temp = ((1.0 / sqrt(log(10.0))) * (-1.0 * (log((-1.0 / re)) * sqrt((1.0 / log(10.0))))));
} else {
double temp_1;
if ((re <= -1.6609468659322656e-174)) {
temp_1 = ((1.0 / sqrt(log(10.0))) * log(pow(sqrt(((re * re) + (im * im))), (1.0 / sqrt(log(10.0))))));
} else {
double temp_2;
if ((re <= 3.7706602894998885e-238)) {
temp_2 = ((1.0 / sqrt(log(10.0))) * log(pow(im, (1.0 / sqrt(log(10.0))))));
} else {
double temp_3;
if ((re <= 2.4617813008158136e+77)) {
temp_3 = ((1.0 / sqrt(log(10.0))) * log(pow(sqrt(((re * re) + (im * im))), (1.0 / sqrt(log(10.0))))));
} else {
temp_3 = ((1.0 / sqrt(log(10.0))) * log(pow((1.0 / re), -sqrt((1.0 / log(10.0))))));
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}



Bits error versus re



Bits error versus im
Results
if re < -2.5154987231457308e+88Initial program 49.1
rmApplied add-sqr-sqrt49.1
Applied pow149.1
Applied log-pow49.1
Applied times-frac49.1
Taylor expanded around -inf 11.1
if -2.5154987231457308e+88 < re < -1.6609468659322656e-174 or 3.7706602894998885e-238 < re < 2.4617813008158136e+77Initial program 18.8
rmApplied add-sqr-sqrt18.8
Applied pow118.8
Applied log-pow18.8
Applied times-frac18.7
rmApplied add-log-exp18.7
Simplified18.5
if -1.6609468659322656e-174 < re < 3.7706602894998885e-238Initial program 33.2
rmApplied add-sqr-sqrt33.2
Applied pow133.2
Applied log-pow33.2
Applied times-frac33.1
rmApplied add-log-exp33.1
Simplified33.0
Taylor expanded around 0 33.9
if 2.4617813008158136e+77 < re Initial program 48.5
rmApplied add-sqr-sqrt48.5
Applied pow148.5
Applied log-pow48.5
Applied times-frac48.5
rmApplied add-log-exp48.5
Simplified48.4
Taylor expanded around inf 10.3
Simplified10.2
Final simplification18.1
herbie shell --seed 2020053
(FPCore (re im)
:name "math.log10 on complex, real part"
:precision binary64
(/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))