Average Error: 31.9 → 0.5
Time: 8.2s
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 r47671 = re;
        double r47672 = r47671 * r47671;
        double r47673 = im;
        double r47674 = r47673 * r47673;
        double r47675 = r47672 + r47674;
        double r47676 = sqrt(r47675);
        double r47677 = log(r47676);
        double r47678 = base;
        double r47679 = log(r47678);
        double r47680 = r47677 * r47679;
        double r47681 = atan2(r47673, r47671);
        double r47682 = 0.0;
        double r47683 = r47681 * r47682;
        double r47684 = r47680 + r47683;
        double r47685 = r47679 * r47679;
        double r47686 = r47682 * r47682;
        double r47687 = r47685 + r47686;
        double r47688 = r47684 / r47687;
        return r47688;
}

double f(double re, double im, double base) {
        double r47689 = base;
        double r47690 = log(r47689);
        double r47691 = re;
        double r47692 = im;
        double r47693 = hypot(r47691, r47692);
        double r47694 = log(r47693);
        double r47695 = atan2(r47692, r47691);
        double r47696 = 0.0;
        double r47697 = r47695 * r47696;
        double r47698 = fma(r47690, r47694, r47697);
        double r47699 = hypot(r47690, r47696);
        double r47700 = 1.0;
        double r47701 = r47699 * r47700;
        double r47702 = r47698 / r47701;
        double r47703 = 6.0;
        double r47704 = pow(r47690, r47703);
        double r47705 = cbrt(r47704);
        double r47706 = r47696 * r47696;
        double r47707 = r47705 + r47706;
        double r47708 = sqrt(r47707);
        double r47709 = r47702 / r47708;
        return r47709;
}

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))))