Average Error: 31.4 → 18.7
Time: 2.7m
Precision: 64
Internal Precision: 384
\[\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}\]
\[\begin{array}{l} \mathbf{if}\;-re \le -8.542892668141158 \cdot 10^{+77}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \mathbf{if}\;-re \le -1.0500749767168825 \cdot 10^{-167}:\\ \;\;\;\;\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \left(\log base \cdot \log base\right)\\ \mathbf{if}\;-re \le -4.709972278205245 \cdot 10^{-213}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;-re \le -1.9898044016399362 \cdot 10^{-296}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.379906015225545 \cdot 10^{-242}:\\ \;\;\;\;\left(\frac{\log base}{\log base} \cdot \frac{\log base}{\log base}\right) \cdot \left(\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\right)\\ \mathbf{if}\;-re \le 2.0645235123650541 \cdot 10^{-197}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.351104460839845 \cdot 10^{-155}:\\ \;\;\;\;\left(\frac{\log base}{\log base} \cdot \frac{\log base}{\log base}\right) \cdot \left(\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\right)\\ \mathbf{if}\;-re \le 5.110421437955086 \cdot 10^{+49}:\\ \;\;\;\;\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \left(\log base \cdot \log base\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 6 regimes
  2. if (- re) < -8.542892668141158e+77

    1. Initial program 46.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. Taylor expanded around inf 10.4

      \[\leadsto \color{blue}{\frac{\log \left(\frac{1}{re}\right)}{\log \left(\frac{1}{base}\right)}}\]
    3. Applied simplify10.4

      \[\leadsto \color{blue}{\frac{-\log re}{-\log base}}\]

    if -8.542892668141158e+77 < (- re) < -1.0500749767168825e-167 or 3.351104460839845e-155 < (- re) < 5.110421437955086e+49

    1. Initial program 16.1

      \[\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. Using strategy rm
    3. Applied flip-+16.1

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

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

      \[\leadsto \color{blue}{\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)} \cdot \left(\log base \cdot \log base - 0 \cdot 0\right)\]

    if -1.0500749767168825e-167 < (- re) < -4.709972278205245e-213

    1. Initial program 35.3

      \[\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. Using strategy rm
    3. Applied flip-+35.4

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

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

      \[\leadsto \color{blue}{\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)} \cdot \left(\log base \cdot \log base - 0 \cdot 0\right)\]
    6. Taylor expanded around -inf 37.2

      \[\leadsto \left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \color{blue}{\left(-1 \cdot im\right)}\right) \cdot \left(\log base \cdot \log base - 0 \cdot 0\right)\]
    7. Applied simplify37.2

      \[\leadsto \color{blue}{\frac{\log \left(-im\right)}{\log base}}\]

    if -4.709972278205245e-213 < (- re) < -1.9898044016399362e-296 or 3.379906015225545e-242 < (- re) < 2.0645235123650541e-197

    1. Initial program 30.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. Taylor expanded around 0 34.8

      \[\leadsto \color{blue}{\frac{\log im}{\log base}}\]

    if -1.9898044016399362e-296 < (- re) < 3.379906015225545e-242 or 2.0645235123650541e-197 < (- re) < 3.351104460839845e-155

    1. Initial program 30.4

      \[\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. Using strategy rm
    3. Applied flip-+30.4

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

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

      \[\leadsto \color{blue}{\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)} \cdot \left(\log base \cdot \log base - 0 \cdot 0\right)\]
    6. Taylor expanded around -inf 62.8

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{\log \left(\frac{-1}{im}\right)}{{\left(\log -1 - \log \left(\frac{-1}{base}\right)\right)}^{3}}\right)} \cdot \left(\log base \cdot \log base - 0 \cdot 0\right)\]
    7. Applied simplify34.1

      \[\leadsto \color{blue}{\left(\frac{\log base}{\log base} \cdot \frac{\log base}{\log base}\right) \cdot \left(\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\right)}\]

    if 5.110421437955086e+49 < (- re)

    1. Initial program 44.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. Taylor expanded around -inf 12.1

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

      \[\leadsto \color{blue}{\frac{\log \left(-re\right)}{\log base}}\]
  3. Recombined 6 regimes into one program.
  4. Applied simplify18.7

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;-re \le -8.542892668141158 \cdot 10^{+77}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \mathbf{if}\;-re \le -1.0500749767168825 \cdot 10^{-167}:\\ \;\;\;\;\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \left(\log base \cdot \log base\right)\\ \mathbf{if}\;-re \le -4.709972278205245 \cdot 10^{-213}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;-re \le -1.9898044016399362 \cdot 10^{-296}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.379906015225545 \cdot 10^{-242}:\\ \;\;\;\;\left(\frac{\log base}{\log base} \cdot \frac{\log base}{\log base}\right) \cdot \left(\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\right)\\ \mathbf{if}\;-re \le 2.0645235123650541 \cdot 10^{-197}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.351104460839845 \cdot 10^{-155}:\\ \;\;\;\;\left(\frac{\log base}{\log base} \cdot \frac{\log base}{\log base}\right) \cdot \left(\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\right)\\ \mathbf{if}\;-re \le 5.110421437955086 \cdot 10^{+49}:\\ \;\;\;\;\left(\frac{\frac{\frac{1}{\log base}}{\log base}}{\log base} \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \left(\log base \cdot \log base\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \end{array}}\]

Runtime

Time bar (total: 2.7m)Debug logProfile

herbie shell --seed '#(1070991898 1055468627 4280279443 640792587 928206309 3646738750)' 
(FPCore (re im base)
  :name "math.log/2 on complex, real part"
  (/ (+ (* (log (sqrt (+ (* re re) (* im im)))) (log base)) (* (atan2 im re) 0)) (+ (* (log base) (log base)) (* 0 0))))