Average Error: 31.8 → 0.5
Time: 4.7s
Precision: 64
\[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
\[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}
\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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 r99894 = im;
        double r99895 = re;
        double r99896 = atan2(r99894, r99895);
        double r99897 = base;
        double r99898 = log(r99897);
        double r99899 = r99896 * r99898;
        double r99900 = r99895 * r99895;
        double r99901 = r99894 * r99894;
        double r99902 = r99900 + r99901;
        double r99903 = sqrt(r99902);
        double r99904 = log(r99903);
        double r99905 = 0.0;
        double r99906 = r99904 * r99905;
        double r99907 = r99899 - r99906;
        double r99908 = r99898 * r99898;
        double r99909 = r99905 * r99905;
        double r99910 = r99908 + r99909;
        double r99911 = r99907 / r99910;
        return r99911;
}

double f(double re, double im, double base) {
        double r99912 = im;
        double r99913 = re;
        double r99914 = atan2(r99912, r99913);
        double r99915 = base;
        double r99916 = log(r99915);
        double r99917 = r99914 * r99916;
        double r99918 = 1.0;
        double r99919 = hypot(r99913, r99912);
        double r99920 = r99918 * r99919;
        double r99921 = log(r99920);
        double r99922 = 0.0;
        double r99923 = r99921 * r99922;
        double r99924 = r99917 - r99923;
        double r99925 = 2.0;
        double r99926 = cbrt(r99915);
        double r99927 = log(r99926);
        double r99928 = r99925 * r99927;
        double r99929 = r99916 * r99928;
        double r99930 = r99916 * r99927;
        double r99931 = r99929 + r99930;
        double r99932 = r99922 * r99922;
        double r99933 = r99931 + r99932;
        double r99934 = r99924 / r99933;
        return r99934;
}

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 31.8

    \[\frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity31.8

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

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

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

    \[\leadsto \frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \color{blue}{\mathsf{hypot}\left(re, im\right)}\right) \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{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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.5

    \[\leadsto \frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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.5

    \[\leadsto \frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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.5

    \[\leadsto \frac{\tan^{-1}_* \frac{im}{re} \cdot \log base - \log \left(1 \cdot \mathsf{hypot}\left(re, im\right)\right) \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 2020064 +o rules:numerics
(FPCore (re im base)
  :name "math.log/2 on complex, imaginary part"
  :precision binary64
  (/ (- (* (atan2 im re) (log base)) (* (log (sqrt (+ (* re re) (* im im)))) 0.0)) (+ (* (log base) (log base)) (* 0.0 0.0))))