\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}
\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}
(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 (/ (log (hypot re im)) (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) {
return log(hypot(re, im)) / log(base);
}



Bits error versus re



Bits error versus im



Bits error versus base
Results
Initial program 31.8
Simplified0.4
Applied clear-num_binary640.4
Applied div-inv_binary640.5
Applied *-un-lft-identity_binary640.5
Applied times-frac_binary640.5
Applied pow1_binary640.5
Applied log-pow_binary640.5
Applied add-sqr-sqrt_binary640.5
Applied times-frac_binary640.5
Applied associate-*l*_binary640.5
Simplified0.4
Final simplification0.4
herbie shell --seed 2021275
(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))))