Average Error: 31.4 → 12.5
Time: 1.8m
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}\;im \le -3.3955093218469717 \cdot 10^{+145}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;im \le -1.3901459543564231 \cdot 10^{-276}:\\ \;\;\;\;\frac{1}{\frac{\log base}{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}}\\ \mathbf{if}\;im \le 1.2864286111203345 \cdot 10^{-223}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{if}\;im \le 9.303283361974231 \cdot 10^{+95}:\\ \;\;\;\;\frac{\log base}{\frac{\log base \cdot \log base}{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 5 regimes
  2. if im < -3.3955093218469717e+145

    1. Initial program 59.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. Applied simplify59.9

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

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

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

    if -3.3955093218469717e+145 < im < -1.3901459543564231e-276

    1. Initial program 20.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. Applied simplify20.1

      \[\leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base \cdot \log base}}\]
    3. Using strategy rm
    4. Applied clear-num20.2

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

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

    if -1.3901459543564231e-276 < im < 1.2864286111203345e-223

    1. Initial program 31.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. Applied simplify31.2

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

      \[\leadsto \frac{\log base \cdot \log \color{blue}{re}}{\log base \cdot \log base}\]
    4. Applied simplify0.4

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

    if 1.2864286111203345e-223 < im < 9.303283361974231e+95

    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. Applied simplify19.1

      \[\leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base \cdot \log base}}\]
    3. Using strategy rm
    4. Applied associate-/l*19.1

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

    if 9.303283361974231e+95 < im

    1. Initial program 50.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. Applied simplify50.2

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

      \[\leadsto \frac{\log base \cdot \log \color{blue}{im}}{\log base \cdot \log base}\]
    4. Applied simplify0.4

      \[\leadsto \color{blue}{\frac{\log im}{\log base}}\]
  3. Recombined 5 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 1.8m)Debug logProfile

herbie shell --seed '#(1062930989 876886121 3990119081 3032829768 3060892583 1929069376)' 
(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))))