\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\begin{array}{l}
\mathbf{if}\;im \le -1.3441617536124223 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sqrt{\log \left(-re\right)}}{\log base} \cdot \sqrt{\log \left(-re\right)}\\
\mathbf{elif}\;im \le -1541871735.4493983:\\
\;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}\\
\mathbf{elif}\;im \le -4.4197911913014276 \cdot 10^{-44}:\\
\;\;\;\;\frac{1}{\log base} \cdot \log \left(-re\right)\\
\mathbf{elif}\;im \le -1.3801630952498305 \cdot 10^{-128}:\\
\;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base}\\
\mathbf{elif}\;im \le 4.8135459158735706 \cdot 10^{+17}:\\
\;\;\;\;\frac{\log \left(\sqrt[3]{-re}\right)}{\log base} + \frac{\log \left(\sqrt[3]{-re}\right) + \log \left(\sqrt[3]{-re}\right)}{\log base}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log im}{\log base}\\
\end{array}double f(double re, double im, double base) {
double r1675713 = re;
double r1675714 = r1675713 * r1675713;
double r1675715 = im;
double r1675716 = r1675715 * r1675715;
double r1675717 = r1675714 + r1675716;
double r1675718 = sqrt(r1675717);
double r1675719 = log(r1675718);
double r1675720 = base;
double r1675721 = log(r1675720);
double r1675722 = r1675719 * r1675721;
double r1675723 = atan2(r1675715, r1675713);
double r1675724 = 0.0;
double r1675725 = r1675723 * r1675724;
double r1675726 = r1675722 + r1675725;
double r1675727 = r1675721 * r1675721;
double r1675728 = r1675724 * r1675724;
double r1675729 = r1675727 + r1675728;
double r1675730 = r1675726 / r1675729;
return r1675730;
}
double f(double re, double im, double base) {
double r1675731 = im;
double r1675732 = -1.3441617536124223e+154;
bool r1675733 = r1675731 <= r1675732;
double r1675734 = re;
double r1675735 = -r1675734;
double r1675736 = log(r1675735);
double r1675737 = sqrt(r1675736);
double r1675738 = base;
double r1675739 = log(r1675738);
double r1675740 = r1675737 / r1675739;
double r1675741 = r1675740 * r1675737;
double r1675742 = -1541871735.4493983;
bool r1675743 = r1675731 <= r1675742;
double r1675744 = r1675734 * r1675734;
double r1675745 = r1675731 * r1675731;
double r1675746 = r1675744 + r1675745;
double r1675747 = sqrt(r1675746);
double r1675748 = log(r1675747);
double r1675749 = r1675748 / r1675739;
double r1675750 = -4.4197911913014276e-44;
bool r1675751 = r1675731 <= r1675750;
double r1675752 = 1.0;
double r1675753 = r1675752 / r1675739;
double r1675754 = r1675753 * r1675736;
double r1675755 = -1.3801630952498305e-128;
bool r1675756 = r1675731 <= r1675755;
double r1675757 = 4.8135459158735706e+17;
bool r1675758 = r1675731 <= r1675757;
double r1675759 = cbrt(r1675735);
double r1675760 = log(r1675759);
double r1675761 = r1675760 / r1675739;
double r1675762 = r1675760 + r1675760;
double r1675763 = r1675762 / r1675739;
double r1675764 = r1675761 + r1675763;
double r1675765 = log(r1675731);
double r1675766 = r1675765 / r1675739;
double r1675767 = r1675758 ? r1675764 : r1675766;
double r1675768 = r1675756 ? r1675749 : r1675767;
double r1675769 = r1675751 ? r1675754 : r1675768;
double r1675770 = r1675743 ? r1675749 : r1675769;
double r1675771 = r1675733 ? r1675741 : r1675770;
return r1675771;
}



Bits error versus re



Bits error versus im



Bits error versus base
Results
if im < -1.3441617536124223e+154Initial program 62.0
Simplified62.0
Taylor expanded around -inf 51.4
Simplified51.4
rmApplied clear-num51.4
Simplified51.4
rmApplied div-inv51.4
Applied *-un-lft-identity51.4
Applied times-frac51.4
Simplified51.4
rmApplied add-sqr-sqrt51.3
Applied associate-*r*51.3
Simplified51.3
if -1.3441617536124223e+154 < im < -1541871735.4493983 or -4.4197911913014276e-44 < im < -1.3801630952498305e-128Initial program 15.4
Simplified15.4
rmApplied times-frac15.3
Simplified15.3
if -1541871735.4493983 < im < -4.4197911913014276e-44Initial program 16.6
Simplified16.6
Taylor expanded around -inf 24.6
Simplified24.6
rmApplied clear-num24.6
Simplified24.6
rmApplied div-inv24.6
Applied *-un-lft-identity24.6
Applied times-frac24.6
Simplified24.6
if -1.3801630952498305e-128 < im < 4.8135459158735706e+17Initial program 24.7
Simplified24.7
Taylor expanded around -inf 12.3
Simplified12.3
rmApplied clear-num12.3
Simplified12.2
rmApplied div-inv12.3
Applied *-un-lft-identity12.3
Applied times-frac12.3
Simplified12.2
rmApplied add-cube-cbrt12.2
Applied log-prod12.3
Applied distribute-lft-in12.3
Simplified12.2
Simplified12.2
if 4.8135459158735706e+17 < im Initial program 40.3
Simplified40.3
Taylor expanded around 0 12.8
Final simplification18.3
herbie shell --seed 2019133
(FPCore (re im base)
:name "math.log/2 on complex, real part"
(/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0)) (+ (* (log base) (log base)) (* 0 0))))