Average Error: 32.1 → 17.8
Time: 7.7s
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 -1.33764999557969208 \cdot 10^{66}:\\ \;\;\;\;\frac{\log \left(-re\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(\log base \cdot \log \left(\sqrt[3]{base}\right) + 2 \cdot \left(\log base \cdot \log \left(\sqrt[3]{base}\right)\right)\right) + 0.0 \cdot 0.0}\\ \mathbf{elif}\;re \le 3.53919578709125943 \cdot 10^{32}:\\ \;\;\;\;\frac{1}{\frac{0.0 \cdot 0.0 + {\left(\log base\right)}^{2}}{\tan^{-1}_* \frac{im}{re} \cdot 0.0 + \log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\log base}{\log re}}\\ \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 < -1.33764999557969208e66

    1. Initial program 46.4

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

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

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

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

      \[\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}{2 \cdot \left(\log base \cdot \log \left(\sqrt[3]{base}\right)\right)} + \log base \cdot \log \left(\sqrt[3]{base}\right)\right) + 0.0 \cdot 0.0}\]
    7. Taylor expanded around -inf 9.9

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

      \[\leadsto \frac{\log \color{blue}{\left(-re\right)} \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0.0}{\left(2 \cdot \left(\log base \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.33764999557969208e66 < re < 3.53919578709125943e32

    1. Initial program 22.7

      \[\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 clear-num22.8

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

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

    if 3.53919578709125943e32 < re

    1. Initial program 43.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 clear-num43.5

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\log 1 - \log \left(\frac{1}{base}\right)}{\log 1 - \log \left(\frac{1}{re}\right)}}}\]
    6. Simplified12.0

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

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

Reproduce

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