Average Error: 30.8 → 17.3
Time: 4.1m
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}\;-im \le -3.280556283645574 \cdot 10^{+55}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-im \le -2.6204380796035766 \cdot 10^{-247}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{{\left(\log base\right)}^{3} \cdot \left(\log base \cdot \log base\right)} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{if}\;-im \le 1.1050152881333996 \cdot 10^{-289}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \mathbf{if}\;-im \le 1.708472900206682 \cdot 10^{+72}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{{\left(\log base\right)}^{3} \cdot \left(\log base \cdot \log base\right)} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\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) < -3.280556283645574e+55

    1. Initial program 43.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. Taylor expanded around 0 10.3

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

    if -3.280556283645574e+55 < (- im) < -2.6204380796035766e-247 or 1.1050152881333996e-289 < (- im) < 1.708472900206682e+72

    1. Initial program 20.7

      \[\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. Using strategy rm
    3. Applied flip3-+20.8

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\color{blue}{\frac{{\left(\log base \cdot \log base\right)}^{3} + {\left(0 \cdot 0\right)}^{3}}{\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(\log base \cdot \log base\right) \cdot \left(0 \cdot 0\right)\right)}}}\]
    4. Applied associate-/r/20.8

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{{\left(\log base \cdot \log base\right)}^{3} + {\left(0 \cdot 0\right)}^{3}} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(\log base \cdot \log base\right) \cdot \left(0 \cdot 0\right)\right)\right)}\]
    5. Applied simplify20.8

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

    if -2.6204380796035766e-247 < (- im) < 1.1050152881333996e-289

    1. Initial program 30.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. Taylor expanded around inf 31.7

      \[\leadsto \color{blue}{\frac{\log \left(\frac{1}{re}\right)}{\log \left(\frac{1}{base}\right)}}\]
    3. Applied simplify31.7

      \[\leadsto \color{blue}{\frac{-\log re}{-\log base}}\]

    if 1.708472900206682e+72 < (- im)

    1. Initial program 45.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. Using strategy rm
    3. Applied flip3-+45.5

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\color{blue}{\frac{{\left(\log base \cdot \log base\right)}^{3} + {\left(0 \cdot 0\right)}^{3}}{\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(\log base \cdot \log base\right) \cdot \left(0 \cdot 0\right)\right)}}}\]
    4. Applied associate-/r/45.5

      \[\leadsto \color{blue}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{{\left(\log base \cdot \log base\right)}^{3} + {\left(0 \cdot 0\right)}^{3}} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(\log base \cdot \log base\right) \cdot \left(0 \cdot 0\right)\right)\right)}\]
    5. Applied simplify45.5

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

      \[\leadsto \frac{\log \color{blue}{\left(-1 \cdot im\right)}}{{\left(\log base\right)}^{3} \cdot \left(\log base \cdot \log base\right)} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(\log base \cdot \log base\right) \cdot \left(0 \cdot 0\right)\right)\right)\]
    7. Applied simplify10.4

      \[\leadsto \color{blue}{\frac{\log \left(-im\right)}{\frac{\log base}{1}}}\]
  3. Recombined 4 regimes into one program.
  4. Applied simplify17.3

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;-im \le -3.280556283645574 \cdot 10^{+55}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-im \le -2.6204380796035766 \cdot 10^{-247}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{{\left(\log base\right)}^{3} \cdot \left(\log base \cdot \log base\right)} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{if}\;-im \le 1.1050152881333996 \cdot 10^{-289}:\\ \;\;\;\;\frac{-\log re}{-\log base}\\ \mathbf{if}\;-im \le 1.708472900206682 \cdot 10^{+72}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{{\left(\log base\right)}^{3} \cdot \left(\log base \cdot \log base\right)} \cdot \left(\left(\log base \cdot \log base\right) \cdot \left(\log base \cdot \log base\right) + \left(\left(0 \cdot 0\right) \cdot \left(0 \cdot 0\right) - \left(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \end{array}}\]

Runtime

Time bar (total: 4.1m)Debug logProfile

herbie shell --seed '#(1072743783 989954326 4239155542 3782239461 3602631542 1719177920)' 
(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))))