\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}\;im \le -2.263962099580682894408810458484502827138 \cdot 10^{113}:\\
\;\;\;\;\frac{-\log \left(\frac{-1}{im}\right)}{\log base}\\
\mathbf{elif}\;im \le 7.983252801042693681446527510289719577487 \cdot 10^{137}:\\
\;\;\;\;\frac{\left(\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \left(\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) - \left(\tan^{-1}_* \frac{im}{re} \cdot 0.0\right) \cdot \left(\tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\left({\left(\log base\right)}^{2} + 0.0 \cdot 0.0\right) \cdot \left(\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right) - \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\log im}{-\log base}\\
\end{array}double f(double re, double im, double base) {
double r103095 = re;
double r103096 = r103095 * r103095;
double r103097 = im;
double r103098 = r103097 * r103097;
double r103099 = r103096 + r103098;
double r103100 = sqrt(r103099);
double r103101 = log(r103100);
double r103102 = base;
double r103103 = log(r103102);
double r103104 = r103101 * r103103;
double r103105 = atan2(r103097, r103095);
double r103106 = 0.0;
double r103107 = r103105 * r103106;
double r103108 = r103104 + r103107;
double r103109 = r103103 * r103103;
double r103110 = r103106 * r103106;
double r103111 = r103109 + r103110;
double r103112 = r103108 / r103111;
return r103112;
}
double f(double re, double im, double base) {
double r103113 = im;
double r103114 = -2.263962099580683e+113;
bool r103115 = r103113 <= r103114;
double r103116 = -1.0;
double r103117 = r103116 / r103113;
double r103118 = log(r103117);
double r103119 = -r103118;
double r103120 = base;
double r103121 = log(r103120);
double r103122 = r103119 / r103121;
double r103123 = 7.983252801042694e+137;
bool r103124 = r103113 <= r103123;
double r103125 = re;
double r103126 = r103125 * r103125;
double r103127 = r103113 * r103113;
double r103128 = r103126 + r103127;
double r103129 = sqrt(r103128);
double r103130 = log(r103129);
double r103131 = r103121 * r103130;
double r103132 = r103131 * r103131;
double r103133 = atan2(r103113, r103125);
double r103134 = 0.0;
double r103135 = r103133 * r103134;
double r103136 = r103135 * r103135;
double r103137 = r103132 - r103136;
double r103138 = 2.0;
double r103139 = pow(r103121, r103138);
double r103140 = r103134 * r103134;
double r103141 = r103139 + r103140;
double r103142 = r103131 - r103135;
double r103143 = r103141 * r103142;
double r103144 = r103137 / r103143;
double r103145 = log(r103113);
double r103146 = -r103145;
double r103147 = -r103121;
double r103148 = r103146 / r103147;
double r103149 = r103124 ? r103144 : r103148;
double r103150 = r103115 ? r103122 : r103149;
return r103150;
}



Bits error versus re



Bits error versus im



Bits error versus base
Results
if im < -2.263962099580683e+113Initial program 53.9
rmApplied *-un-lft-identity53.9
Applied log-prod53.9
Applied distribute-lft-in53.9
Simplified53.9
Simplified53.9
rmApplied add-sqr-sqrt53.9
Applied *-un-lft-identity53.9
Applied times-frac53.9
Simplified53.9
Simplified53.9
Taylor expanded around -inf 64.0
Simplified7.6
if -2.263962099580683e+113 < im < 7.983252801042694e+137Initial program 22.0
rmApplied *-un-lft-identity22.0
Applied log-prod22.0
Applied distribute-lft-in22.0
Simplified22.0
Simplified22.0
rmApplied flip-+22.0
Applied associate-/l/22.1
Simplified22.1
if 7.983252801042694e+137 < im Initial program 59.1
rmApplied *-un-lft-identity59.1
Applied log-prod59.1
Applied distribute-lft-in59.1
Simplified59.1
Simplified59.1
rmApplied add-sqr-sqrt59.1
Applied *-un-lft-identity59.1
Applied times-frac59.1
Simplified59.1
Simplified59.1
Taylor expanded around inf 7.3
Simplified7.3
Final simplification17.8
herbie shell --seed 2019323
(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))))