Average Error: 30.3 → 17.4
Time: 56.7s
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 -4.546843496143031 \cdot 10^{+109}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le 3.4389244313109046 \cdot 10^{+40}:\\ \;\;\;\;\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) \cdot \frac{1}{\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 < -4.546843496143031e+109

    1. Initial program 51.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 simplification51.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 add-cbrt-cube51.4

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

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

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

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

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

      \[\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. 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)}}\]
    11. Simplified8.2

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

    if -4.546843496143031e+109 < re < 3.4389244313109046e+40

    1. Initial program 21.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 simplification21.4

      \[\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 div-inv21.5

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

    if 3.4389244313109046e+40 < re

    1. Initial program 41.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 simplification41.3

      \[\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 12.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -4.546843496143031 \cdot 10^{+109}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le 3.4389244313109046 \cdot 10^{+40}:\\ \;\;\;\;\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \end{array}\]

Runtime

Time bar (total: 56.7s)Debug logProfile

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