Average Error: 31.0 → 18.0
Time: 29.3s
Precision: 64
Internal Precision: 576
\[\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 -5.593865474774411 \cdot 10^{+130}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;re \le -1.4756208210601557 \cdot 10^{-221}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(\sqrt[3]{im \cdot im + re \cdot re}\right) + \log \left(\sqrt[3]{im \cdot im + re \cdot re} \cdot \sqrt[3]{im \cdot im + re \cdot re}\right)}}\\ \mathbf{elif}\;re \le 5.274018757413312 \cdot 10^{-145}:\\ \;\;\;\;\frac{\log im \cdot \log base}{\log base \cdot \log base}\\ \mathbf{elif}\;re \le 1.1497306388576276 \cdot 10^{+80}:\\ \;\;\;\;\log \left(im \cdot im + re \cdot re\right) \cdot \frac{\frac{1}{2}}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \end{array}\]

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. Split input into 5 regimes
  2. if re < -5.593865474774411e+130

    1. Initial program 56.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. Initial simplification56.3

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied times-frac56.3

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \frac{\log base}{\log base}}\]
    5. Simplified56.3

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

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)}}{\log base} \cdot 1\]
    7. Simplified6.4

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

    if -5.593865474774411e+130 < re < -1.4756208210601557e-221

    1. Initial program 18.7

      \[\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. Initial simplification18.7

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied times-frac18.6

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \frac{\log base}{\log base}}\]
    5. Simplified18.6

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \color{blue}{1}\]
    6. Using strategy rm
    7. Applied pow1/218.6

      \[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{\frac{1}{2}}\right)}}{\log base} \cdot 1\]
    8. Applied log-pow18.6

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log base} \cdot 1\]
    9. Applied associate-/l*18.6

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}} \cdot 1\]
    10. Using strategy rm
    11. Applied add-cube-cbrt18.7

      \[\leadsto \frac{\frac{1}{2}}{\frac{\log base}{\log \color{blue}{\left(\left(\sqrt[3]{re \cdot re + im \cdot im} \cdot \sqrt[3]{re \cdot re + im \cdot im}\right) \cdot \sqrt[3]{re \cdot re + im \cdot im}\right)}}} \cdot 1\]
    12. Applied log-prod18.7

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

    if -1.4756208210601557e-221 < re < 5.274018757413312e-145

    1. Initial program 29.2

      \[\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. Initial simplification29.2

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Taylor expanded around 0 34.8

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

    if 5.274018757413312e-145 < re < 1.1497306388576276e+80

    1. Initial program 16.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. Initial simplification16.3

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied times-frac16.2

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \frac{\log base}{\log base}}\]
    5. Simplified16.2

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \color{blue}{1}\]
    6. Using strategy rm
    7. Applied pow1/216.2

      \[\leadsto \frac{\log \color{blue}{\left({\left(re \cdot re + im \cdot im\right)}^{\frac{1}{2}}\right)}}{\log base} \cdot 1\]
    8. Applied log-pow16.2

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \log \left(re \cdot re + im \cdot im\right)}}{\log base} \cdot 1\]
    9. Applied associate-/l*16.2

      \[\leadsto \color{blue}{\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}} \cdot 1\]
    10. Using strategy rm
    11. Applied associate-/r/16.2

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

    if 1.1497306388576276e+80 < re

    1. Initial program 47.6

      \[\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. Initial simplification47.6

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied times-frac47.5

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log base} \cdot \frac{\log base}{\log base}}\]
    5. Simplified47.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -5.593865474774411 \cdot 10^{+130}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{elif}\;re \le -1.4756208210601557 \cdot 10^{-221}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(\sqrt[3]{im \cdot im + re \cdot re}\right) + \log \left(\sqrt[3]{im \cdot im + re \cdot re} \cdot \sqrt[3]{im \cdot im + re \cdot re}\right)}}\\ \mathbf{elif}\;re \le 5.274018757413312 \cdot 10^{-145}:\\ \;\;\;\;\frac{\log im \cdot \log base}{\log base \cdot \log base}\\ \mathbf{elif}\;re \le 1.1497306388576276 \cdot 10^{+80}:\\ \;\;\;\;\log \left(im \cdot im + re \cdot re\right) \cdot \frac{\frac{1}{2}}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \end{array}\]

Runtime

Time bar (total: 29.3s)Debug logProfile

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