Average Error: 31.5 → 0.5
Time: 5.5s
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{1}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} \cdot \left(\log \left(\mathsf{hypot}\left(im, re\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 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{1}{\mathsf{fma}\left(0.0, 0.0, {\left(\log base\right)}^{2}\right)} \cdot \left(\log \left(\mathsf{hypot}\left(im, re\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0\right)
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 ((1.0 / fma(0.0, 0.0, pow(log(base), 2.0))) * ((log(hypot(im, re)) * log(base)) + (atan2(im, re) * 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.5

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

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

    \[\leadsto \frac{\log \color{blue}{\left(\mathsf{hypot}\left(im, re\right)\right)} \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\log base \cdot \log base + 0.0 \cdot 0.0}\]
  5. Using strategy rm
  6. Applied clear-num0.5

    \[\leadsto \color{blue}{\frac{1}{\frac{\log base \cdot \log base + 0.0 \cdot 0.0}{\log \left(\mathsf{hypot}\left(im, re\right)\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}}}\]
  7. Using strategy rm
  8. Applied associate-/r/0.5

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

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

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

Reproduce

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