Average Error: 31.9 → 0.5
Time: 8.8s
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{1}{\frac{\mathsf{hypot}\left(\log base, 0.0\right)}{\mathsf{fma}\left(\log base, \log \left(\mathsf{hypot}\left(re, im\right)\right), \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}}}{\sqrt{\left(\left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) \cdot \log base + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 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{1}{\frac{\mathsf{hypot}\left(\log base, 0.0\right)}{\mathsf{fma}\left(\log base, \log \left(\mathsf{hypot}\left(re, im\right)\right), \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}}}{\sqrt{\left(\left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) \cdot \log base + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}}
double f(double re, double im, double base) {
        double r51453 = re;
        double r51454 = r51453 * r51453;
        double r51455 = im;
        double r51456 = r51455 * r51455;
        double r51457 = r51454 + r51456;
        double r51458 = sqrt(r51457);
        double r51459 = log(r51458);
        double r51460 = base;
        double r51461 = log(r51460);
        double r51462 = r51459 * r51461;
        double r51463 = atan2(r51455, r51453);
        double r51464 = 0.0;
        double r51465 = r51463 * r51464;
        double r51466 = r51462 + r51465;
        double r51467 = r51461 * r51461;
        double r51468 = r51464 * r51464;
        double r51469 = r51467 + r51468;
        double r51470 = r51466 / r51469;
        return r51470;
}

double f(double re, double im, double base) {
        double r51471 = 1.0;
        double r51472 = base;
        double r51473 = log(r51472);
        double r51474 = 0.0;
        double r51475 = hypot(r51473, r51474);
        double r51476 = re;
        double r51477 = im;
        double r51478 = hypot(r51476, r51477);
        double r51479 = log(r51478);
        double r51480 = atan2(r51477, r51476);
        double r51481 = r51480 * r51474;
        double r51482 = fma(r51473, r51479, r51481);
        double r51483 = r51475 / r51482;
        double r51484 = r51471 / r51483;
        double r51485 = 2.0;
        double r51486 = cbrt(r51472);
        double r51487 = log(r51486);
        double r51488 = r51485 * r51487;
        double r51489 = r51488 * r51473;
        double r51490 = r51473 * r51487;
        double r51491 = r51489 + r51490;
        double r51492 = r51474 * r51474;
        double r51493 = r51491 + r51492;
        double r51494 = sqrt(r51493);
        double r51495 = r51484 / r51494;
        return r51495;
}

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 *-un-lft-identity31.9

    \[\leadsto \frac{\log \left(\sqrt{\color{blue}{1 \cdot \left(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. Applied sqrt-prod31.9

    \[\leadsto \frac{\log \color{blue}{\left(\sqrt{1} \cdot \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}\]
  5. Simplified31.9

    \[\leadsto \frac{\log \left(\color{blue}{1} \cdot \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}\]
  6. Simplified0.5

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

    \[\leadsto \frac{\log \left(1 \cdot \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}}}\]
  9. Applied associate-/r*0.4

    \[\leadsto \color{blue}{\frac{\frac{\log \left(1 \cdot \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}}}{\sqrt{\log base \cdot \log base + 0.0 \cdot 0.0}}}\]
  10. 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}}\]
  11. Using strategy rm
  12. Applied clear-num0.5

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

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

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

    \[\leadsto \frac{\frac{1}{\frac{\mathsf{hypot}\left(\log base, 0.0\right)}{\mathsf{fma}\left(\log base, \log \left(\mathsf{hypot}\left(re, im\right)\right), \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}}}{\sqrt{\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}}\]
  17. Applied distribute-lft-in0.5

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

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

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

Reproduce

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