Average Error: 30.7 → 17.5
Time: 43.9s
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 -7.266161600389518 \cdot 10^{+142}:\\ \;\;\;\;\frac{1}{\frac{-\log base}{\log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \le 2.0267169770552964 \cdot 10^{-281}:\\ \;\;\;\;\frac{1}{\frac{\log base \cdot \log base}{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}}\\ \mathbf{elif}\;re \le 1.0336891779074329 \cdot 10^{-137}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 8.623049544666381 \cdot 10^{+99}:\\ \;\;\;\;\frac{1}{\frac{\log base \cdot \log base}{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-\log base}{-\log re}}\\ \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 < -7.266161600389518e+142

    1. Initial program 59.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 simplification59.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 clear-num59.3

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

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

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

    if -7.266161600389518e+142 < re < 2.0267169770552964e-281 or 1.0336891779074329e-137 < re < 8.623049544666381e+99

    1. Initial program 19.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 simplification19.1

      \[\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 clear-num19.2

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

    if 2.0267169770552964e-281 < re < 1.0336891779074329e-137

    1. Initial program 29.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. Initial simplification29.4

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

      \[\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 33.9

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

    if 8.623049544666381e+99 < re

    1. Initial program 49.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. Initial simplification49.7

      \[\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 clear-num49.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -7.266161600389518 \cdot 10^{+142}:\\ \;\;\;\;\frac{1}{\frac{-\log base}{\log \left(\frac{-1}{re}\right)}}\\ \mathbf{elif}\;re \le 2.0267169770552964 \cdot 10^{-281}:\\ \;\;\;\;\frac{1}{\frac{\log base \cdot \log base}{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}}\\ \mathbf{elif}\;re \le 1.0336891779074329 \cdot 10^{-137}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 8.623049544666381 \cdot 10^{+99}:\\ \;\;\;\;\frac{1}{\frac{\log base \cdot \log base}{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{-\log base}{-\log re}}\\ \end{array}\]

Runtime

Time bar (total: 43.9s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes30.817.57.123.756.1%
herbie shell --seed 2018295 
(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))))