Average Error: 31.8 → 0.6
Time: 9.9s
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{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) + \sqrt[3]{{\left(\log \left(\sqrt{base}\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)}^{3}}\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 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{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) + \sqrt[3]{{\left(\log \left(\sqrt{base}\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)}^{3}}\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}
double code(double re, double im, double base) {
	return ((double) (((double) (((double) (((double) log(((double) sqrt(((double) (((double) (re * re)) + ((double) (im * im)))))))) * ((double) log(base)))) + ((double) (((double) atan2(im, re)) * 0.0)))) / ((double) (((double) (((double) log(base)) * ((double) log(base)))) + ((double) (0.0 * 0.0))))));
}
double code(double re, double im, double base) {
	return ((double) (((double) (((double) (((double) (((double) (((double) (((double) log(((double) cbrt(((double) hypot(re, im)))))) * 2.0)) * ((double) log(((double) sqrt(base)))))) + ((double) (((double) log(((double) sqrt(base)))) * ((double) log(((double) cbrt(((double) hypot(re, im)))))))))) + ((double) cbrt(((double) pow(((double) (((double) log(((double) sqrt(base)))) * ((double) log(((double) hypot(re, im)))))), 3.0)))))) + ((double) (((double) atan2(im, re)) * 0.0)))) / ((double) (((double) (((double) log(base)) * ((double) log(base)))) + ((double) (0.0 * 0.0))))));
}

Error

Bits error versus re

Bits error versus im

Bits error versus base

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.8

    \[\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-sqr-sqrt31.8

    \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log \color{blue}{\left(\sqrt{base} \cdot \sqrt{base}\right)} + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  4. Applied log-prod31.8

    \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \color{blue}{\left(\log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right)\right)} + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  5. Applied distribute-lft-in31.8

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

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

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

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

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

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

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

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

    \[\leadsto \frac{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \color{blue}{\log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)}\right) + \log \left(\sqrt{base}\right) \cdot \left(1 \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  15. Using strategy rm
  16. Applied add-cbrt-cube0.6

    \[\leadsto \frac{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) + \log \left(\sqrt{base}\right) \cdot \left(1 \cdot \color{blue}{\sqrt[3]{\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}}\right)\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  17. Applied add-cbrt-cube0.6

    \[\leadsto \frac{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) + \log \left(\sqrt{base}\right) \cdot \left(\color{blue}{\sqrt[3]{\left(1 \cdot 1\right) \cdot 1}} \cdot \sqrt[3]{\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}\right)\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  18. Applied cbrt-unprod0.6

    \[\leadsto \frac{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) + \log \left(\sqrt{base}\right) \cdot \color{blue}{\sqrt[3]{\left(\left(1 \cdot 1\right) \cdot 1\right) \cdot \left(\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)}}\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  19. Applied add-cbrt-cube0.6

    \[\leadsto \frac{\left(\left(\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right) \cdot 2\right) \cdot \log \left(\sqrt{base}\right) + \log \left(\sqrt{base}\right) \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(re, im\right)}\right)\right) + \color{blue}{\sqrt[3]{\left(\log \left(\sqrt{base}\right) \cdot \log \left(\sqrt{base}\right)\right) \cdot \log \left(\sqrt{base}\right)}} \cdot \sqrt[3]{\left(\left(1 \cdot 1\right) \cdot 1\right) \cdot \left(\left(\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)\right)}\right) + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  20. Applied cbrt-unprod0.6

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

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

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

Reproduce

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