Average Error: 30.3 → 16.6
Time: 1.7m
Precision: 64
Internal Precision: 128
\[\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 -1.2068211949372295 \cdot 10^{+73}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}{\log base}}{\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 2 regimes
  2. if re < -1.2068211949372295e+73

    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. 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. Simplified9.8

      \[\leadsto \color{blue}{\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)}\]
    5. Using strategy rm
    6. Applied add-exp-log9.8

      \[\leadsto \frac{-1}{\log base} \cdot \log \color{blue}{\left(e^{\log \left(\frac{-1}{re}\right)}\right)}\]
    7. Applied rem-log-exp9.8

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

    if -1.2068211949372295e+73 < re

    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 associate-/r*20.9

      \[\leadsto \color{blue}{\frac{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base}}{\log base}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.6

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

Runtime

Time bar (total: 1.7m)Debug logProfile

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