Average Error: 31.4 → 17.6
Time: 22.2s
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 -2.1226002320891086 \cdot 10^{+97}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base \cdot \frac{-1}{2}}{\log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \le -7.290641851332745 \cdot 10^{-245}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}\\ \mathbf{elif}\;re \le 1.0681814895237214 \cdot 10^{-175}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 1.426271733522574 \cdot 10^{+123}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}\\ \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 4 regimes
  2. if re < -2.1226002320891086e+97

    1. Initial program 49.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 simplification49.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-frac49.6

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

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

      \[\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-pow49.6

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

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

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

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

    if -2.1226002320891086e+97 < re < -7.290641851332745e-245 or 1.0681814895237214e-175 < re < 1.426271733522574e+123

    1. Initial program 18.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 simplification18.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 times-frac18.3

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

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

      \[\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-pow18.3

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

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

    if -7.290641851332745e-245 < re < 1.0681814895237214e-175

    1. Initial program 31.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 simplification31.0

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

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

    if 1.426271733522574e+123 < re

    1. Initial program 55.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 simplification55.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-frac55.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -2.1226002320891086 \cdot 10^{+97}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base \cdot \frac{-1}{2}}{\log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \le -7.290641851332745 \cdot 10^{-245}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}\\ \mathbf{elif}\;re \le 1.0681814895237214 \cdot 10^{-175}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 1.426271733522574 \cdot 10^{+123}:\\ \;\;\;\;\frac{\frac{1}{2}}{\frac{\log base}{\log \left(re \cdot re + im \cdot im\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \end{array}\]

Runtime

Time bar (total: 22.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes31.417.67.623.858%
herbie shell --seed 2018285 
(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))))