Average Error: 32.5 → 0.4
Time: 11.9s
Precision: binary64
\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0} \]
\[\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base} \]
\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}
\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}
(FPCore (re im base)
 :precision binary64
 (/
  (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0.0))
  (+ (* (log base) (log base)) (* 0.0 0.0))))
(FPCore (re im base) :precision binary64 (/ (log (hypot re im)) (log base)))
double code(double re, double im, double base) {
	return ((log(sqrt((re * re) + (im * im))) * log(base)) + (atan2(im, re) * 0.0)) / ((log(base) * log(base)) + (0.0 * 0.0));
}
double code(double re, double im, double base) {
	return log(hypot(re, im)) / log(base);
}

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 32.5

    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0} \]
  2. Simplified0.4

    \[\leadsto \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}} \]
  3. Applied add-cbrt-cube_binary640.7

    \[\leadsto \color{blue}{\sqrt[3]{\left(\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}\right) \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}}} \]
  4. Applied frac-times_binary640.7

    \[\leadsto \sqrt[3]{\color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right) \cdot \log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base \cdot \log base}} \cdot \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}} \]
  5. Applied frac-times_binary640.7

    \[\leadsto \sqrt[3]{\color{blue}{\frac{\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)}{\left(\log base \cdot \log base\right) \cdot \log base}}} \]
  6. Applied cbrt-div_binary640.8

    \[\leadsto \color{blue}{\frac{\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)}}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}} \]
  7. Simplified0.8

    \[\leadsto \frac{\color{blue}{\sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}} \]
  8. Simplified0.6

    \[\leadsto \frac{\sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}{\color{blue}{\log base}} \]
  9. Applied pow1_binary640.6

    \[\leadsto \frac{\sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}{\log \color{blue}{\left({base}^{1}\right)}} \]
  10. Applied log-pow_binary640.6

    \[\leadsto \frac{\sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}{\color{blue}{1 \cdot \log base}} \]
  11. Applied pow1_binary640.6

    \[\leadsto \frac{\sqrt[3]{{\log \color{blue}{\left({\left(\mathsf{hypot}\left(im, re\right)\right)}^{1}\right)}}^{3}}}{1 \cdot \log base} \]
  12. Applied log-pow_binary640.6

    \[\leadsto \frac{\sqrt[3]{{\color{blue}{\left(1 \cdot \log \left(\mathsf{hypot}\left(im, re\right)\right)\right)}}^{3}}}{1 \cdot \log base} \]
  13. Applied unpow-prod-down_binary640.6

    \[\leadsto \frac{\sqrt[3]{\color{blue}{{1}^{3} \cdot {\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}}{1 \cdot \log base} \]
  14. Applied cbrt-prod_binary640.6

    \[\leadsto \frac{\color{blue}{\sqrt[3]{{1}^{3}} \cdot \sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}}{1 \cdot \log base} \]
  15. Applied times-frac_binary640.6

    \[\leadsto \color{blue}{\frac{\sqrt[3]{{1}^{3}}}{1} \cdot \frac{\sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}{\log base}} \]
  16. Simplified0.6

    \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{{\log \left(\mathsf{hypot}\left(im, re\right)\right)}^{3}}}{\log base} \]
  17. Simplified0.4

    \[\leadsto 1 \cdot \color{blue}{\frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base}} \]
  18. Final simplification0.4

    \[\leadsto \frac{\log \left(\mathsf{hypot}\left(re, im\right)\right)}{\log base} \]

Reproduce

herbie shell --seed 2021340 
(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))))