Average Error: 31.9 → 0.5
Time: 8.7s
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{\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 1}}{\sqrt{\sqrt[3]{{\left(\log base\right)}^{6}} + 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{\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 1}}{\sqrt{\sqrt[3]{{\left(\log base\right)}^{6}} + 0.0 \cdot 0.0}}
double f(double re, double im, double base) {
        double r47642 = re;
        double r47643 = r47642 * r47642;
        double r47644 = im;
        double r47645 = r47644 * r47644;
        double r47646 = r47643 + r47645;
        double r47647 = sqrt(r47646);
        double r47648 = log(r47647);
        double r47649 = base;
        double r47650 = log(r47649);
        double r47651 = r47648 * r47650;
        double r47652 = atan2(r47644, r47642);
        double r47653 = 0.0;
        double r47654 = r47652 * r47653;
        double r47655 = r47651 + r47654;
        double r47656 = r47650 * r47650;
        double r47657 = r47653 * r47653;
        double r47658 = r47656 + r47657;
        double r47659 = r47655 / r47658;
        return r47659;
}

double f(double re, double im, double base) {
        double r47660 = base;
        double r47661 = log(r47660);
        double r47662 = re;
        double r47663 = im;
        double r47664 = hypot(r47662, r47663);
        double r47665 = log(r47664);
        double r47666 = atan2(r47663, r47662);
        double r47667 = 0.0;
        double r47668 = r47666 * r47667;
        double r47669 = fma(r47661, r47665, r47668);
        double r47670 = hypot(r47661, r47667);
        double r47671 = 1.0;
        double r47672 = r47670 * r47671;
        double r47673 = r47669 / r47672;
        double r47674 = 6.0;
        double r47675 = pow(r47661, r47674);
        double r47676 = cbrt(r47675);
        double r47677 = r47667 * r47667;
        double r47678 = r47676 + r47677;
        double r47679 = sqrt(r47678);
        double r47680 = r47673 / r47679;
        return r47680;
}

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Initial program 31.9

    \[\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 add-exp-log31.9

    \[\leadsto \frac{\log \color{blue}{\left(e^{\log \left(\sqrt{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. Simplified0.5

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

    \[\leadsto \frac{\log \left(e^{\log \left(\mathsf{hypot}\left(re, im\right)\right)}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\color{blue}{\sqrt{\log base \cdot \log base + 0.0 \cdot 0.0} \cdot \sqrt{\log base \cdot \log base + 0.0 \cdot 0.0}}}\]
  7. Applied associate-/r*0.4

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

    \[\leadsto \frac{\color{blue}{\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 1}}}{\sqrt{\log base \cdot \log base + 0.0 \cdot 0.0}}\]
  9. Using strategy rm
  10. Applied add-cbrt-cube0.5

    \[\leadsto \frac{\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 1}}{\sqrt{\log base \cdot \color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}} + 0.0 \cdot 0.0}}\]
  11. Applied add-cbrt-cube0.7

    \[\leadsto \frac{\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 1}}{\sqrt{\color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}} \cdot \sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base} + 0.0 \cdot 0.0}}\]
  12. Applied cbrt-unprod0.5

    \[\leadsto \frac{\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 1}}{\sqrt{\color{blue}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \log base\right) \cdot \left(\left(\log base \cdot \log base\right) \cdot \log base\right)}} + 0.0 \cdot 0.0}}\]
  13. Simplified0.5

    \[\leadsto \frac{\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 1}}{\sqrt{\sqrt[3]{\color{blue}{{\left(\log base\right)}^{6}}} + 0.0 \cdot 0.0}}\]
  14. Final simplification0.5

    \[\leadsto \frac{\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 1}}{\sqrt{\sqrt[3]{{\left(\log base\right)}^{6}} + 0.0 \cdot 0.0}}\]

Reproduce

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