Average Error: 31.9 → 18.3
Time: 59.9s
Precision: 64
Internal Precision: 384
\[\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 -2.1240905627182973 \cdot 10^{+125}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{if}\;-re \le -9.583408992549603 \cdot 10^{-206}:\\ \;\;\;\;\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{if}\;-re \le 4.4277524851547544 \cdot 10^{-288}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.384113125344855 \cdot 10^{-176}:\\ \;\;\;\;\frac{1}{\log base} \cdot \log \left(-im\right)\\ \mathbf{if}\;-re \le 3.928520062221419 \cdot 10^{-159}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{if}\;-re \le 3.574921915104358 \cdot 10^{+73}:\\ \;\;\;\;\frac{1}{\frac{\log base \cdot \log base}{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 6 regimes
  2. if (- re) < -2.1240905627182973e+125

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

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

    if -2.1240905627182973e+125 < (- re) < -9.583408992549603e-206

    1. Initial program 18.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. Using strategy rm
    3. Applied div-inv18.8

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

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

    if -9.583408992549603e-206 < (- re) < 4.4277524851547544e-288 or 3.384113125344855e-176 < (- re) < 3.928520062221419e-159

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

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

    if 4.4277524851547544e-288 < (- re) < 3.384113125344855e-176

    1. Initial program 31.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. Using strategy rm
    3. Applied clear-num31.0

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

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

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

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

    if 3.928520062221419e-159 < (- re) < 3.574921915104358e+73

    1. Initial program 17.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. Using strategy rm
    3. Applied clear-num17.1

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

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

    if 3.574921915104358e+73 < (- re)

    1. Initial program 47.2

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

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

      \[\leadsto \color{blue}{\frac{\log \left(-re\right)}{\log base}}\]
  3. Recombined 6 regimes into one program.

Runtime

Time bar (total: 59.9s)Debug logProfile

herbie shell --seed '#(1064269945 2896236262 301053905 1701069080 1701464310 1614783279)' 
(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))))