Average Error: 31.3 → 18.9
Time: 53.2s
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}\;im \le -2.453006355026506 \cdot 10^{+98}:\\ \;\;\;\;\sqrt[3]{\log \left(\frac{-1}{re}\right) \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \log \left(\frac{-1}{re}\right)\right)} \cdot \frac{-1}{\log base}\\ \mathbf{elif}\;im \le -4.584334208320103:\\ \;\;\;\;\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{elif}\;im \le 4.2734741656329414 \cdot 10^{-44}:\\ \;\;\;\;\log \left(\frac{-1}{re}\right) \cdot \frac{-1}{\log base}\\ \mathbf{elif}\;im \le 2.8251957203945042 \cdot 10^{+68}:\\ \;\;\;\;\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 im}{\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 im < -2.453006355026506e+98

    1. Initial program 51.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. Simplified51.6

      \[\leadsto \color{blue}{\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. Simplified49.0

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

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

    if -2.453006355026506e+98 < im < -4.584334208320103 or 4.2734741656329414e-44 < im < 2.8251957203945042e+68

    1. Initial program 15.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. Simplified15.6

      \[\leadsto \color{blue}{\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-inv15.7

      \[\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 -4.584334208320103 < im < 4.2734741656329414e-44

    1. Initial program 23.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. Simplified23.5

      \[\leadsto \color{blue}{\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. Simplified12.5

      \[\leadsto \color{blue}{\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)}\]
    5. Taylor expanded around -inf 12.5

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

    if 2.8251957203945042e+68 < im

    1. Initial program 46.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. Simplified46.1

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

      \[\leadsto \color{blue}{\frac{\log im}{\log base}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification18.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;im \le -2.453006355026506 \cdot 10^{+98}:\\ \;\;\;\;\sqrt[3]{\log \left(\frac{-1}{re}\right) \cdot \left(\log \left(\frac{-1}{re}\right) \cdot \log \left(\frac{-1}{re}\right)\right)} \cdot \frac{-1}{\log base}\\ \mathbf{elif}\;im \le -4.584334208320103:\\ \;\;\;\;\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{elif}\;im \le 4.2734741656329414 \cdot 10^{-44}:\\ \;\;\;\;\log \left(\frac{-1}{re}\right) \cdot \frac{-1}{\log base}\\ \mathbf{elif}\;im \le 2.8251957203945042 \cdot 10^{+68}:\\ \;\;\;\;\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 im}{\log base}\\ \end{array}\]

Reproduce

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