Average Error: 31.3 → 17.1
Time: 8.9s
Precision: binary64
\[\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}\]
\[\begin{array}{l} \mathbf{if}\;re \le -6.04576933425727388 \cdot 10^{89}:\\ \;\;\;\;\frac{\log \left(-1 \cdot re\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(-{0.0}^{3}\right) \cdot 0.0 + {\left(\log base\right)}^{3} \cdot \log base} \cdot \left(\log base \cdot \log base - 0.0 \cdot 0.0\right)\\ \mathbf{elif}\;re \le 1.6493808279984082 \cdot 10^{86}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{0 + \log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 3 regimes
  2. if re < -6.04576933425727388e89

    1. Initial program 49.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 flip-+49.5

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

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

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(-{0.0}^{3}\right) \cdot 0.0 + {\left(\log base\right)}^{3} \cdot \log base}} \cdot \left(\log base \cdot \log base - 0.0 \cdot 0.0\right)\]
    6. Taylor expanded around -inf 9.6

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

    if -6.04576933425727388e89 < re < 1.6493808279984082e86

    1. Initial program 21.2

      \[\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-cube-cbrt21.2

      \[\leadsto \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 \color{blue}{\left(\left(\sqrt[3]{base} \cdot \sqrt[3]{base}\right) \cdot \sqrt[3]{base}\right)} + 0.0 \cdot 0.0}\]
    4. Applied log-prod21.3

      \[\leadsto \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 \color{blue}{\left(\log \left(\sqrt[3]{base} \cdot \sqrt[3]{base}\right) + \log \left(\sqrt[3]{base}\right)\right)} + 0.0 \cdot 0.0}\]
    5. Applied distribute-lft-in21.3

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

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

    if 1.6493808279984082e86 < re

    1. Initial program 49.9

      \[\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. Taylor expanded around inf 9.5

      \[\leadsto \color{blue}{\frac{\log 1 - \log \left(\frac{1}{re}\right)}{\log 1 - \log \left(\frac{1}{base}\right)}}\]
    3. Simplified9.5

      \[\leadsto \color{blue}{\frac{\log re}{0 + \log base}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification17.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -6.04576933425727388 \cdot 10^{89}:\\ \;\;\;\;\frac{\log \left(-1 \cdot re\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(-{0.0}^{3}\right) \cdot 0.0 + {\left(\log base\right)}^{3} \cdot \log base} \cdot \left(\log base \cdot \log base - 0.0 \cdot 0.0\right)\\ \mathbf{elif}\;re \le 1.6493808279984082 \cdot 10^{86}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \left(2 \cdot \log \left(\sqrt[3]{base}\right)\right) + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{0 + \log base}\\ \end{array}\]

Reproduce

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