Average Error: 31.7 → 0.5
Time: 7.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{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base - \tan^{-1}_* \frac{im}{re} \cdot 0.0} \cdot \frac{{\left(\log base\right)}^{2}}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} - \frac{\left(\tan^{-1}_* \frac{im}{re} \cdot \tan^{-1}_* \frac{im}{re}\right) \cdot 0.0}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} \cdot \frac{0.0}{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base - \tan^{-1}_* \frac{im}{re} \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(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base - \tan^{-1}_* \frac{im}{re} \cdot 0.0} \cdot \frac{{\left(\log base\right)}^{2}}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} - \frac{\left(\tan^{-1}_* \frac{im}{re} \cdot \tan^{-1}_* \frac{im}{re}\right) \cdot 0.0}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} \cdot \frac{0.0}{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base - \tan^{-1}_* \frac{im}{re} \cdot 0.0}
double f(double re, double im, double base) {
        double r41588 = re;
        double r41589 = r41588 * r41588;
        double r41590 = im;
        double r41591 = r41590 * r41590;
        double r41592 = r41589 + r41591;
        double r41593 = sqrt(r41592);
        double r41594 = log(r41593);
        double r41595 = base;
        double r41596 = log(r41595);
        double r41597 = r41594 * r41596;
        double r41598 = atan2(r41590, r41588);
        double r41599 = 0.0;
        double r41600 = r41598 * r41599;
        double r41601 = r41597 + r41600;
        double r41602 = r41596 * r41596;
        double r41603 = r41599 * r41599;
        double r41604 = r41602 + r41603;
        double r41605 = r41601 / r41604;
        return r41605;
}

double f(double re, double im, double base) {
        double r41606 = re;
        double r41607 = im;
        double r41608 = hypot(r41606, r41607);
        double r41609 = log(r41608);
        double r41610 = r41609 * r41609;
        double r41611 = base;
        double r41612 = log(r41611);
        double r41613 = r41609 * r41612;
        double r41614 = atan2(r41607, r41606);
        double r41615 = 0.0;
        double r41616 = r41614 * r41615;
        double r41617 = r41613 - r41616;
        double r41618 = r41610 / r41617;
        double r41619 = 2.0;
        double r41620 = pow(r41612, r41619);
        double r41621 = fma(r41615, r41615, r41620);
        double r41622 = r41620 / r41621;
        double r41623 = r41618 * r41622;
        double r41624 = r41614 * r41614;
        double r41625 = r41624 * r41615;
        double r41626 = r41625 / r41621;
        double r41627 = r41615 / r41617;
        double r41628 = r41626 * r41627;
        double r41629 = r41623 - r41628;
        return r41629;
}

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Initial program 31.7

    \[\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 flip-+0.5

    \[\leadsto \frac{\color{blue}{\frac{\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base\right) \cdot \left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base\right) - \left(\tan^{-1}_* \frac{im}{re} \cdot 0.0\right) \cdot \left(\tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\log \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}\]
  6. Applied associate-/l/0.6

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

    \[\leadsto \frac{\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base\right) \cdot \left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base\right) - \left(\tan^{-1}_* \frac{im}{re} \cdot 0.0\right) \cdot \left(\tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\color{blue}{\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log base - \tan^{-1}_* \frac{im}{re} \cdot 0.0\right) \cdot \mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}\]
  8. Using strategy rm
  9. Applied div-sub0.6

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

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

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

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

Reproduce

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