Average Error: 31.9 → 0.4
Time: 7.6s
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{1}{\frac{1}{\sqrt[3]{1} \cdot \sqrt[3]{1}}} \cdot \frac{\frac{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(re, im\right)\right), \log base, \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\mathsf{hypot}\left(\log base, 0.0\right)}}{\mathsf{hypot}\left(\log base, 0.0\right)}\]
\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}{\frac{1}{\sqrt[3]{1} \cdot \sqrt[3]{1}}} \cdot \frac{\frac{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(re, im\right)\right), \log base, \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\mathsf{hypot}\left(\log base, 0.0\right)}}{\mathsf{hypot}\left(\log base, 0.0\right)}
double f(double re, double im, double base) {
        double r42733 = re;
        double r42734 = r42733 * r42733;
        double r42735 = im;
        double r42736 = r42735 * r42735;
        double r42737 = r42734 + r42736;
        double r42738 = sqrt(r42737);
        double r42739 = log(r42738);
        double r42740 = base;
        double r42741 = log(r42740);
        double r42742 = r42739 * r42741;
        double r42743 = atan2(r42735, r42733);
        double r42744 = 0.0;
        double r42745 = r42743 * r42744;
        double r42746 = r42742 + r42745;
        double r42747 = r42741 * r42741;
        double r42748 = r42744 * r42744;
        double r42749 = r42747 + r42748;
        double r42750 = r42746 / r42749;
        return r42750;
}

double f(double re, double im, double base) {
        double r42751 = 1.0;
        double r42752 = cbrt(r42751);
        double r42753 = r42752 * r42752;
        double r42754 = r42751 / r42753;
        double r42755 = r42751 / r42754;
        double r42756 = re;
        double r42757 = im;
        double r42758 = hypot(r42756, r42757);
        double r42759 = log(r42758);
        double r42760 = base;
        double r42761 = log(r42760);
        double r42762 = atan2(r42757, r42756);
        double r42763 = 0.0;
        double r42764 = r42762 * r42763;
        double r42765 = fma(r42759, r42761, r42764);
        double r42766 = hypot(r42761, r42763);
        double r42767 = r42765 / r42766;
        double r42768 = r42767 / r42766;
        double r42769 = r42755 * r42768;
        return r42769;
}

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 hypot-def0.5

    \[\leadsto \frac{\log \color{blue}{\left(\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}\]
  4. Using strategy rm
  5. Applied add-sqr-sqrt0.5

    \[\leadsto \frac{\log \left(\mathsf{hypot}\left(re, im\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}}}\]
  6. Applied *-un-lft-identity0.5

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\left(\frac{1}{\frac{1}{\sqrt[3]{1} \cdot \sqrt[3]{1}}} \cdot \frac{1}{\frac{\mathsf{hypot}\left(\log base, 0.0\right)}{\sqrt[3]{1}}}\right)} \cdot \frac{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(re, im\right)\right), \log base, \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\mathsf{hypot}\left(\log base, 0.0\right) \cdot 1}\]
  16. Applied associate-*l*0.5

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

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

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

Reproduce

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