Average Error: 30.9 → 18.8
Time: 3.7m
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 -3.9325624087256016 \cdot 10^{+71}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;re \le -8.507097926223641 \cdot 10^{-188}:\\ \;\;\;\;\frac{\left(\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base\right) \cdot \left(\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base\right) - \left(0 \cdot \tan^{-1}_* \frac{im}{re}\right) \cdot \left(0 \cdot \tan^{-1}_* \frac{im}{re}\right)}{{\left(\log base\right)}^{3} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}\\ \mathbf{if}\;re \le 6.792792913483505 \cdot 10^{-270}:\\ \;\;\;\;\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\\ \mathbf{if}\;re \le 3.143561649479202 \cdot 10^{-228}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;re \le 8.316155498802097 \cdot 10^{-199}:\\ \;\;\;\;\frac{-\log base}{\frac{\log base \cdot \log base}{\log \left(\frac{-1}{im}\right)}}\\ \mathbf{if}\;re \le 3.843162264734765 \cdot 10^{+76}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{\log \left(im \cdot im + re \cdot re\right)}{\sqrt[3]{\log base}}\right)}^{3} \cdot \frac{\frac{\frac{1}{2} \cdot \frac{1}{2}}{\log base}}{\frac{\log base}{\frac{1}{2}}}}\\ \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 7 regimes
  2. if re < -3.9325624087256016e+71

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

      \[\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 simplify10.9

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

    if -3.9325624087256016e+71 < re < -8.507097926223641e-188

    1. Initial program 18.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-+18.3

      \[\leadsto \frac{\color{blue}{\frac{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base\right) \cdot \left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base\right) - \left(\tan^{-1}_* \frac{im}{re} \cdot 0\right) \cdot \left(\tan^{-1}_* \frac{im}{re} \cdot 0\right)}{\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}\]
    4. Applied associate-/l/18.4

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

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

    if -8.507097926223641e-188 < re < 6.792792913483505e-270

    1. Initial program 30.0

      \[\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 add-cbrt-cube30.2

      \[\leadsto \color{blue}{\sqrt[3]{\left(\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} \cdot \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}\right) \cdot \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}}}\]
    4. Applied simplify30.1

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

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

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

    if 6.792792913483505e-270 < re < 3.143561649479202e-228

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

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

    if 3.143561649479202e-228 < re < 8.316155498802097e-199

    1. Initial program 31.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 add-sqr-sqrt31.3

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

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

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

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

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

      \[\leadsto \frac{1}{\sqrt{\log base \cdot \log base}} \cdot \frac{\color{blue}{-1 \cdot \left(\log \left(\frac{-1}{im}\right) \cdot \left(\log -1 - \log \left(\frac{-1}{base}\right)\right)\right)}}{\sqrt{\log base \cdot \log base}}\]
    9. Applied simplify34.9

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

    if 8.316155498802097e-199 < re < 3.843162264734765e+76

    1. Initial program 18.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. Using strategy rm
    3. Applied add-cbrt-cube18.7

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

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{1}}\right)}^{3}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt19.1

      \[\leadsto \sqrt[3]{{\left(\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\color{blue}{\left(\sqrt[3]{\frac{\log base}{1}} \cdot \sqrt[3]{\frac{\log base}{1}}\right) \cdot \sqrt[3]{\frac{\log base}{1}}}}\right)}^{3}}\]
    7. Applied pow1/219.1

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

      \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{\frac{1}{2} \cdot \log \left(im \cdot im + re \cdot re\right)}}{\left(\sqrt[3]{\frac{\log base}{1}} \cdot \sqrt[3]{\frac{\log base}{1}}\right) \cdot \sqrt[3]{\frac{\log base}{1}}}\right)}^{3}}\]
    9. Applied times-frac19.1

      \[\leadsto \sqrt[3]{{\color{blue}{\left(\frac{\frac{1}{2}}{\sqrt[3]{\frac{\log base}{1}} \cdot \sqrt[3]{\frac{\log base}{1}}} \cdot \frac{\log \left(im \cdot im + re \cdot re\right)}{\sqrt[3]{\frac{\log base}{1}}}\right)}}^{3}}\]
    10. Applied unpow-prod-down19.1

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

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

    if 3.843162264734765e+76 < re

    1. Initial program 45.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.8

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

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

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;re \le -3.9325624087256016 \cdot 10^{+71}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;re \le -8.507097926223641 \cdot 10^{-188}:\\ \;\;\;\;\frac{\left(\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base\right) \cdot \left(\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base\right) - \left(0 \cdot \tan^{-1}_* \frac{im}{re}\right) \cdot \left(0 \cdot \tan^{-1}_* \frac{im}{re}\right)}{{\left(\log base\right)}^{3} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}\\ \mathbf{if}\;re \le 6.792792913483505 \cdot 10^{-270}:\\ \;\;\;\;\log \left(\frac{-1}{im}\right) \cdot \frac{-1}{\log base}\\ \mathbf{if}\;re \le 3.143561649479202 \cdot 10^{-228}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;re \le 8.316155498802097 \cdot 10^{-199}:\\ \;\;\;\;\frac{-\log base}{\frac{\log base \cdot \log base}{\log \left(\frac{-1}{im}\right)}}\\ \mathbf{if}\;re \le 3.843162264734765 \cdot 10^{+76}:\\ \;\;\;\;\sqrt[3]{{\left(\frac{\log \left(im \cdot im + re \cdot re\right)}{\sqrt[3]{\log base}}\right)}^{3} \cdot \frac{\frac{\frac{1}{2} \cdot \frac{1}{2}}{\log base}}{\frac{\log base}{\frac{1}{2}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \end{array}}\]

Runtime

Time bar (total: 3.7m)Debug logProfile

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