Average Error: 30.3 → 19.0
Time: 41.8s
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.0813384213579333 \cdot 10^{+98}:\\ \;\;\;\;\left(\log base \cdot \log \left(-re\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{elif}\;re \le -8.489122960153244 \cdot 10^{-97}:\\ \;\;\;\;\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}\\ \mathbf{elif}\;re \le 4.005350697321153 \cdot 10^{-192}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{1}{2} \cdot \frac{\log base}{\log im}}\\ \mathbf{elif}\;re \le 7.776510812884469 \cdot 10^{+102}:\\ \;\;\;\;\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log re \cdot 2}}\\ \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 4 regimes
  2. if re < -4.0813384213579333e+98

    1. Initial program 49.9

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

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

      \[\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 -inf 9.1

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

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

    if -4.0813384213579333e+98 < re < -8.489122960153244e-97 or 4.005350697321153e-192 < re < 7.776510812884469e+102

    1. Initial program 15.9

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

      \[\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-frac15.8

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

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

    if -8.489122960153244e-97 < re < 4.005350697321153e-192

    1. Initial program 27.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 simplification27.1

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

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

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

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

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

      \[\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 0 35.4

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

    if 7.776510812884469e+102 < re

    1. Initial program 50.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 simplification50.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 times-frac50.0

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

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

      \[\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-pow50.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -4.0813384213579333 \cdot 10^{+98}:\\ \;\;\;\;\left(\log base \cdot \log \left(-re\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{elif}\;re \le -8.489122960153244 \cdot 10^{-97}:\\ \;\;\;\;\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}\\ \mathbf{elif}\;re \le 4.005350697321153 \cdot 10^{-192}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{1}{2} \cdot \frac{\log base}{\log im}}\\ \mathbf{elif}\;re \le 7.776510812884469 \cdot 10^{+102}:\\ \;\;\;\;\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log re \cdot 2}}\\ \end{array}\]

Runtime

Time bar (total: 41.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes30.219.06.923.348.2%
herbie shell --seed 2018263 
(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))))