Average Error: 31.8 → 0.4
Time: 13.7s
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 31.8

    \[\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 clear-num_binary640.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}} \]
  4. Applied div-inv_binary640.5

    \[\leadsto \frac{1}{\color{blue}{\log base \cdot \frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}}} \]
  5. Applied *-un-lft-identity_binary640.5

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

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

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

    \[\leadsto \frac{1}{\color{blue}{1 \cdot \log base}} \cdot \frac{1}{\frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}} \]
  9. Applied add-sqr-sqrt_binary640.5

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

    \[\leadsto \color{blue}{\left(\frac{\sqrt{1}}{1} \cdot \frac{\sqrt{1}}{\log base}\right)} \cdot \frac{1}{\frac{1}{\log \left(\mathsf{hypot}\left(re, im\right)\right)}} \]
  11. Applied associate-*l*_binary640.5

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

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

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

Reproduce

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