\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}\frac{1}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} \cdot \left(\log \left(\mathsf{hypot}\left(im, re\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)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 ((1.0 / fma(0.0, 0.0, pow(log(base), 2.0))) * ((log(hypot(im, re)) * log(base)) + (atan2(im, re) * 0.0)));
}



Bits error versus re



Bits error versus im



Bits error versus base
Results
Initial program 31.5
rmApplied +-commutative31.5
Applied hypot-def0.5
rmApplied clear-num0.5
rmApplied associate-/r/0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2020071 +o rules:numerics
(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))))