\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}\;re \leq -7.806590709529468 \cdot 10^{+134}:\\
\;\;\;\;\frac{\log \left(-re\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base}\\
\mathbf{elif}\;re \leq 1.265749424662431 \cdot 10^{+86}:\\
\;\;\;\;\left(\log base \cdot \log base\right) \cdot \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{{\log base}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\log re}{\log base}\\
\end{array}(FPCore (re im base) :precision binary64 (/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))
(FPCore (re im base)
:precision binary64
(if (<= re -7.806590709529468e+134)
(/
(+ (* (log (- re)) (log base)) (* (atan2 im re) 0.0))
(* (log base) (log base)))
(if (<= re 1.265749424662431e+86)
(*
(* (log base) (log base))
(/ (log (sqrt (+ (* re re) (* im im)))) (pow (log base) 3.0)))
(/ (log re) (log base)))))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 tmp;
if (re <= -7.806590709529468e+134) {
tmp = ((log(-re) * log(base)) + (atan2(im, re) * 0.0)) / (log(base) * log(base));
} else if (re <= 1.265749424662431e+86) {
tmp = (log(base) * log(base)) * (log(sqrt((re * re) + (im * im))) / pow(log(base), 3.0));
} else {
tmp = log(re) / log(base);
}
return tmp;
}



Bits error versus re



Bits error versus im



Bits error versus base
Results
if re < -7.80659070952946751e134Initial program 58.6
Taylor expanded around -inf 8.1
Simplified8.1
if -7.80659070952946751e134 < re < 1.2657494246624311e86Initial program 22.3
rmApplied flip-+_binary6422.3
Applied associate-/r/_binary6422.4
Simplified22.3
if 1.2657494246624311e86 < re Initial program 49.9
Simplified49.8
Taylor expanded around inf 9.4
Final simplification18.1
herbie shell --seed 2020224
(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))))