Average Error: 30.8 → 16.8
Time: 1.0m
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 -9.079250232005594 \cdot 10^{+48}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le 5.111636276105649 \cdot 10^{+60}:\\ \;\;\;\;\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 < -9.079250232005594e+48

    1. Initial program 44.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 simplification44.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 62.8

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

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

    if -9.079250232005594e+48 < re < 5.111636276105649e+60

    1. Initial program 20.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 simplification20.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-inv20.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}}\]

    if 5.111636276105649e+60 < re

    1. Initial program 45.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 simplification45.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-frac45.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -9.079250232005594 \cdot 10^{+48}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le 5.111636276105649 \cdot 10^{+60}:\\ \;\;\;\;\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: 1.0m)Debug logProfile

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