Average Error: 30.5 → 17.6
Time: 1.7m
Precision: 64
Internal Precision: 320
\[\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 -6.203564155301159 \cdot 10^{+102}:\\ \;\;\;\;\frac{\frac{\log base \cdot \log \left(-re\right)}{\log base}}{\log base}\\ \mathbf{elif}\;re \le -2.4597713642956447 \cdot 10^{-169}:\\ \;\;\;\;\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{\frac{1}{\log base}}}\\ \mathbf{elif}\;re \le -2.3765210604906362 \cdot 10^{-234}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 2.917275181122833 \cdot 10^{+69}:\\ \;\;\;\;\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{\frac{1}{\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 4 regimes
  2. if re < -6.203564155301159e+102

    1. Initial program 49.8

      \[\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.8

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

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

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

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

    if -6.203564155301159e+102 < re < -2.4597713642956447e-169 or -2.3765210604906362e-234 < re < 2.917275181122833e+69

    1. Initial program 20.3

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

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

      \[\leadsto \color{blue}{\frac{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base}}{\log base}}\]
    5. Using strategy rm
    6. Applied div-inv20.3

      \[\leadsto \frac{\color{blue}{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base\right) \cdot \frac{1}{\log base}}}{\log base}\]
    7. Applied associate-/l*20.3

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

    if -2.4597713642956447e-169 < re < -2.3765210604906362e-234

    1. Initial program 30.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 simplification30.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*30.9

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

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

    if 2.917275181122833e+69 < re

    1. Initial program 45.3

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -6.203564155301159 \cdot 10^{+102}:\\ \;\;\;\;\frac{\frac{\log base \cdot \log \left(-re\right)}{\log base}}{\log base}\\ \mathbf{elif}\;re \le -2.4597713642956447 \cdot 10^{-169}:\\ \;\;\;\;\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{\frac{1}{\log base}}}\\ \mathbf{elif}\;re \le -2.3765210604906362 \cdot 10^{-234}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 2.917275181122833 \cdot 10^{+69}:\\ \;\;\;\;\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{\frac{1}{\log base}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \end{array}\]

Runtime

Time bar (total: 1.7m)Debug logProfile

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