\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{\mathsf{fma}\left(\log base, \log \left(\mathsf{hypot}\left(re, im\right)\right), \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\mathsf{hypot}\left(\log base, 0.0\right) \cdot \mathsf{hypot}\left(\log base, 0.0\right)}double f(double re, double im, double base) {
double r48778 = re;
double r48779 = r48778 * r48778;
double r48780 = im;
double r48781 = r48780 * r48780;
double r48782 = r48779 + r48781;
double r48783 = sqrt(r48782);
double r48784 = log(r48783);
double r48785 = base;
double r48786 = log(r48785);
double r48787 = r48784 * r48786;
double r48788 = atan2(r48780, r48778);
double r48789 = 0.0;
double r48790 = r48788 * r48789;
double r48791 = r48787 + r48790;
double r48792 = r48786 * r48786;
double r48793 = r48789 * r48789;
double r48794 = r48792 + r48793;
double r48795 = r48791 / r48794;
return r48795;
}
double f(double re, double im, double base) {
double r48796 = base;
double r48797 = log(r48796);
double r48798 = re;
double r48799 = im;
double r48800 = hypot(r48798, r48799);
double r48801 = log(r48800);
double r48802 = atan2(r48799, r48798);
double r48803 = 0.0;
double r48804 = r48802 * r48803;
double r48805 = fma(r48797, r48801, r48804);
double r48806 = hypot(r48797, r48803);
double r48807 = r48806 * r48806;
double r48808 = r48805 / r48807;
return r48808;
}



Bits error versus re



Bits error versus im



Bits error versus base
Initial program 31.6
Simplified0.5
rmApplied add-sqr-sqrt0.5
Applied associate-/r*0.4
Simplified0.4
rmApplied div-inv0.5
Simplified0.5
rmApplied log1p-expm1-u0.5
rmApplied *-un-lft-identity0.5
Applied *-un-lft-identity0.5
Applied times-frac0.5
Applied associate-*l*0.5
Simplified0.5
Final simplification0.5
herbie shell --seed 2019306 +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))))