\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\begin{array}{l}
\mathbf{if}\;re \le -2.1945943864727612 \cdot 10^{79}:\\
\;\;\;\;\frac{\log \left(-1 \cdot re\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\\
\mathbf{elif}\;re \le 1.71007923024832044 \cdot 10^{39}:\\
\;\;\;\;\frac{1}{\sqrt{\log base \cdot \log base + 0.0 \cdot 0.0}} \cdot \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\sqrt{\log base \cdot \log base + 0.0 \cdot 0.0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log \left(\frac{1}{re}\right)}{\log \left(\frac{1}{base}\right)}\\
\end{array}double code(double re, double im, double base) {
return (((log(sqrt(((re * re) + (im * im)))) * log(base)) + (atan2(im, re) * 0.0)) / ((log(base) * log(base)) + (0.0 * 0.0)));
}
double code(double re, double im, double base) {
double temp;
if ((re <= -2.1945943864727612e+79)) {
temp = (((log((-1.0 * re)) * log(base)) + (atan2(im, re) * 0.0)) / (((log(base) * (2.0 * log(cbrt(base)))) + (log(base) * log(cbrt(base)))) + (0.0 * 0.0)));
} else {
double temp_1;
if ((re <= 1.7100792302483204e+39)) {
temp_1 = ((1.0 / sqrt(((log(base) * log(base)) + (0.0 * 0.0)))) * (((log(sqrt(((re * re) + (im * im)))) * log(base)) + (atan2(im, re) * 0.0)) / sqrt(((log(base) * log(base)) + (0.0 * 0.0)))));
} else {
temp_1 = (log((1.0 / re)) / log((1.0 / base)));
}
temp = temp_1;
}
return temp;
}



Bits error versus re



Bits error versus im



Bits error versus base
Results
if re < -2.1945943864727612e+79Initial program 50.1
rmApplied add-cube-cbrt50.1
Applied log-prod50.1
Applied distribute-lft-in50.1
Simplified50.1
Taylor expanded around -inf 10.4
if -2.1945943864727612e+79 < re < 1.7100792302483204e+39Initial program 22.7
rmApplied add-sqr-sqrt22.7
Applied *-un-lft-identity22.7
Applied times-frac22.7
if 1.7100792302483204e+39 < re Initial program 44.5
Taylor expanded around inf 12.4
Final simplification18.2
herbie shell --seed 2020058
(FPCore (re im base)
:name "math.log/2 on complex, real part"
:precision binary64
(/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))