Average Error: 31.0 → 17.8
Time: 52.4s
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 -7.954449727655894 \cdot 10^{+140}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le 4.551727447137176 \cdot 10^{+52}:\\ \;\;\;\;\sqrt[3]{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{1}{\frac{1}{\log base}}}} \cdot \sqrt[3]{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base \cdot \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 3 regimes
  2. if re < -7.954449727655894e+140

    1. Initial program 58.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. Initial simplification58.4

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

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

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

    if -7.954449727655894e+140 < re < 4.551727447137176e+52

    1. Initial program 21.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 simplification21.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 add-cbrt-cube21.7

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\color{blue}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right)\right) \cdot \left(\log base \cdot \log base\right)}}}\]
    5. Applied add-cbrt-cube21.8

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right)\right) \cdot \left(\log base \cdot \log base\right)}}\]
    6. Applied add-cbrt-cube21.9

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)}} \cdot \sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right)\right) \cdot \left(\log base \cdot \log base\right)}}\]
    7. Applied cbrt-unprod21.8

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \left(\left(\log base \cdot \log base\right) \cdot \log base\right)}}}{\sqrt[3]{\left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right)\right) \cdot \left(\log base \cdot \log base\right)}}\]
    8. Applied cbrt-undiv21.7

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

      \[\leadsto \sqrt[3]{\color{blue}{\frac{{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right)\right)}^{3}}{\frac{\log base \cdot \log base}{\frac{1}{\log base}}}}}\]
    10. Using strategy rm
    11. Applied div-inv21.7

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

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

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

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

    if 4.551727447137176e+52 < re

    1. Initial program 43.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. Initial simplification43.1

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

      \[\leadsto \color{blue}{\frac{\log \left(\frac{1}{re}\right)}{\log \left(\frac{1}{base}\right)}}\]
    4. Simplified11.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -7.954449727655894 \cdot 10^{+140}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le 4.551727447137176 \cdot 10^{+52}:\\ \;\;\;\;\sqrt[3]{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{1}{\frac{1}{\log base}}}} \cdot \sqrt[3]{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base \cdot \log base}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \end{array}\]

Runtime

Time bar (total: 52.4s)Debug logProfile

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