Average Error: 31.6 → 0.4
Time: 23.4s
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 \left(\mathsf{hypot}\left(re, im\right)\right), \log base, \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)}{\mathsf{hypot}\left(0.0, \log base\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{\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(0.0, \log base\right)}}{\mathsf{hypot}\left(\log base, 0.0\right)}
double f(double re, double im, double base) {
        double r104479 = re;
        double r104480 = r104479 * r104479;
        double r104481 = im;
        double r104482 = r104481 * r104481;
        double r104483 = r104480 + r104482;
        double r104484 = sqrt(r104483);
        double r104485 = log(r104484);
        double r104486 = base;
        double r104487 = log(r104486);
        double r104488 = r104485 * r104487;
        double r104489 = atan2(r104481, r104479);
        double r104490 = 0.0;
        double r104491 = r104489 * r104490;
        double r104492 = r104488 + r104491;
        double r104493 = r104487 * r104487;
        double r104494 = r104490 * r104490;
        double r104495 = r104493 + r104494;
        double r104496 = r104492 / r104495;
        return r104496;
}

double f(double re, double im, double base) {
        double r104497 = re;
        double r104498 = im;
        double r104499 = hypot(r104497, r104498);
        double r104500 = log(r104499);
        double r104501 = base;
        double r104502 = log(r104501);
        double r104503 = atan2(r104498, r104497);
        double r104504 = 0.0;
        double r104505 = r104503 * r104504;
        double r104506 = fma(r104500, r104502, r104505);
        double r104507 = hypot(r104504, r104502);
        double r104508 = r104506 / r104507;
        double r104509 = hypot(r104502, r104504);
        double r104510 = r104508 / r104509;
        return r104510;
}

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Initial program 31.6

    \[\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. Simplified0.5

    \[\leadsto \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{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.5

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

    \[\leadsto \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)}{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}\]
  6. Simplified0.4

    \[\leadsto \frac{\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)}}}{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt0.4

    \[\leadsto \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)}}{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)} \cdot \sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}}\]
  9. Applied sqrt-prod0.7

    \[\leadsto \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)}}{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}}\]
  10. Applied add-sqr-sqrt1.0

    \[\leadsto \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)}{\color{blue}{\sqrt{\mathsf{hypot}\left(\log base, 0.0\right)} \cdot \sqrt{\mathsf{hypot}\left(\log base, 0.0\right)}}}}{\sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}\]
  11. Applied *-un-lft-identity1.0

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

    \[\leadsto \frac{\color{blue}{\frac{1}{\sqrt{\mathsf{hypot}\left(\log base, 0.0\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)}{\sqrt{\mathsf{hypot}\left(\log base, 0.0\right)}}}}{\sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}\]
  13. Applied times-frac1.0

    \[\leadsto \color{blue}{\frac{\frac{1}{\sqrt{\mathsf{hypot}\left(\log base, 0.0\right)}}}{\sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}} \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)}{\sqrt{\mathsf{hypot}\left(\log base, 0.0\right)}}}{\sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}}\]
  14. Simplified0.7

    \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(\log base, 0.0\right)}} \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)}{\sqrt{\mathsf{hypot}\left(\log base, 0.0\right)}}}{\sqrt{\sqrt{\mathsf{fma}\left(\log base, \log base, 0.0 \cdot 0.0\right)}}}\]
  15. Simplified0.5

    \[\leadsto \frac{1}{\mathsf{hypot}\left(\log base, 0.0\right)} \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(0.0, \log base\right)}}\]
  16. Using strategy rm
  17. Applied add-cube-cbrt0.5

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\mathsf{hypot}\left(\log base, 0.0\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(0.0, \log base\right)}\]
  18. Applied associate-/l*0.5

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

    \[\leadsto \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\color{blue}{\mathsf{hypot}\left(\log base, 0.0\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(0.0, \log base\right)}\]
  20. Using strategy rm
  21. Applied *-un-lft-identity0.5

    \[\leadsto \color{blue}{\left(1 \cdot \frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\mathsf{hypot}\left(\log base, 0.0\right)}\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(0.0, \log base\right)}\]
  22. Applied associate-*l*0.5

    \[\leadsto \color{blue}{1 \cdot \left(\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\mathsf{hypot}\left(\log base, 0.0\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(0.0, \log base\right)}\right)}\]
  23. Simplified0.4

    \[\leadsto 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(0.0, \log base\right)}}{\mathsf{hypot}\left(\log base, 0.0\right)}}\]
  24. Final simplification0.4

    \[\leadsto \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(0.0, \log base\right)}}{\mathsf{hypot}\left(\log base, 0.0\right)}\]

Reproduce

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