Average Error: 32.4 → 0.6
Time: 8.1s
Precision: 64
\[\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{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\]
\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{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}
double f(double re, double im, double base) {
        double r50979 = re;
        double r50980 = r50979 * r50979;
        double r50981 = im;
        double r50982 = r50981 * r50981;
        double r50983 = r50980 + r50982;
        double r50984 = sqrt(r50983);
        double r50985 = log(r50984);
        double r50986 = base;
        double r50987 = log(r50986);
        double r50988 = r50985 * r50987;
        double r50989 = atan2(r50981, r50979);
        double r50990 = 0.0;
        double r50991 = r50989 * r50990;
        double r50992 = r50988 + r50991;
        double r50993 = r50987 * r50987;
        double r50994 = r50990 * r50990;
        double r50995 = r50993 + r50994;
        double r50996 = r50992 / r50995;
        return r50996;
}

double f(double re, double im, double base) {
        double r50997 = 1.0;
        double r50998 = re;
        double r50999 = im;
        double r51000 = hypot(r50998, r50999);
        double r51001 = r50997 * r51000;
        double r51002 = log(r51001);
        double r51003 = base;
        double r51004 = log(r51003);
        double r51005 = r51002 * r51004;
        double r51006 = atan2(r50999, r50998);
        double r51007 = 0.0;
        double r51008 = r51006 * r51007;
        double r51009 = r51005 + r51008;
        double r51010 = 2.0;
        double r51011 = cbrt(r51003);
        double r51012 = log(r51011);
        double r51013 = r51010 * r51012;
        double r51014 = r51004 * r51013;
        double r51015 = r51004 * r51012;
        double r51016 = r51014 + r51015;
        double r51017 = r51007 * r51007;
        double r51018 = r51016 + r51017;
        double r51019 = r51009 / r51018;
        return r51019;
}

Error

Bits error versus re

Bits error versus im

Bits error versus base

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 32.4

    \[\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}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity32.4

    \[\leadsto \frac{\log \left(\sqrt{\color{blue}{1 \cdot \left(re \cdot re + im \cdot im\right)}}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  4. Applied sqrt-prod32.4

    \[\leadsto \frac{\log \color{blue}{\left(\sqrt{1} \cdot \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}\]
  5. Simplified32.4

    \[\leadsto \frac{\log \left(\color{blue}{1} \cdot \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}\]
  6. Simplified0.5

    \[\leadsto \frac{\log \left(1 \cdot \color{blue}{\mathsf{hypot}\left(re, im\right)}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  7. Using strategy rm
  8. Applied add-cube-cbrt0.5

    \[\leadsto \frac{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log \color{blue}{\left(\left(\sqrt[3]{base} \cdot \sqrt[3]{base}\right) \cdot \sqrt[3]{base}\right)} + 0.0 \cdot 0.0}\]
  9. Applied log-prod0.5

    \[\leadsto \frac{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \color{blue}{\left(\log \left(\sqrt[3]{base} \cdot \sqrt[3]{base}\right) + \log \left(\sqrt[3]{base}\right)\right)} + 0.0 \cdot 0.0}\]
  10. Applied distribute-lft-in0.6

    \[\leadsto \frac{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\color{blue}{\left(\log base \cdot \log \left(\sqrt[3]{base} \cdot \sqrt[3]{base}\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right)} + 0.0 \cdot 0.0}\]
  11. Simplified0.6

    \[\leadsto \frac{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\color{blue}{\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right)} + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\]
  12. Final simplification0.6

    \[\leadsto \frac{\log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\]

Reproduce

herbie shell --seed 2020020 +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))))