Average Error: 31.4 → 17.7
Time: 35.0s
Precision: 64
Internal Precision: 320
\[\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.032633512294002 \cdot 10^{+152}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{-2 \cdot \log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \le -3.4292901023242434 \cdot 10^{-277}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}\\ \mathbf{elif}\;re \le 5.928920661504328 \cdot 10^{-282}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 0.9320144263799299:\\ \;\;\;\;\left(\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{2 \cdot \log re}}\\ \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.032633512294002e+152

    1. Initial program 61.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. Initial simplification61.5

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

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

      \[\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/261.5

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

      \[\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*61.5

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

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

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

    if -5.032633512294002e+152 < re < -3.4292901023242434e-277

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

      \[\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-frac19.7

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

      \[\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/219.7

      \[\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-pow19.7

      \[\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*19.7

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

    if -3.4292901023242434e-277 < re < 5.928920661504328e-282

    1. Initial program 29.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. Initial simplification29.0

      \[\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-inv29.1

      \[\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}}\]
    5. Taylor expanded around 0 32.0

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

    if 5.928920661504328e-282 < re < 0.9320144263799299

    1. Initial program 22.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 simplification22.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 div-inv22.3

      \[\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 0.9320144263799299 < re

    1. Initial program 40.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 simplification40.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-frac40.5

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

      \[\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/240.5

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

      \[\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*40.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -5.032633512294002 \cdot 10^{+152}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{-2 \cdot \log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \le -3.4292901023242434 \cdot 10^{-277}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}\\ \mathbf{elif}\;re \le 5.928920661504328 \cdot 10^{-282}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 0.9320144263799299:\\ \;\;\;\;\left(\log base \cdot \log \left(\sqrt{re \cdot re + im \cdot im}\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{2 \cdot \log re}}\\ \end{array}\]

Runtime

Time bar (total: 35.0s)Debug logProfile

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