Average Error: 31.0 → 19.0
Time: 1.1m
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 -1.1245346812756974 \cdot 10^{+136}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;re \le -1.2961514114440863 \cdot 10^{-282}:\\ \;\;\;\;\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(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{if}\;re \le 3.2387365401267583 \cdot 10^{-279}:\\ \;\;\;\;\frac{\log base \cdot \log im}{\log base \cdot \log base}\\ \mathbf{if}\;re \le 7.500694230410355 \cdot 10^{-120}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\frac{\log base}{1}}\\ \mathbf{if}\;re \le 7.791107505106573 \cdot 10^{-91}:\\ \;\;\;\;\frac{\log base \cdot \log im}{\log base \cdot \log base}\\ \mathbf{if}\;re \le 1.9962265802966908 \cdot 10^{+130}:\\ \;\;\;\;\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(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\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 re < -1.1245346812756974e+136

    1. Initial program 57.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.6

      \[\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 simplify7.5

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

    if -1.1245346812756974e+136 < re < -1.2961514114440863e-282 or 7.791107505106573e-91 < re < 1.9962265802966908e+130

    1. Initial program 18.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-+18.7

      \[\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/18.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 simplify18.7

      \[\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 -1.2961514114440863e-282 < re < 3.2387365401267583e-279 or 7.500694230410355e-120 < re < 7.791107505106573e-91

    1. Initial program 25.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 0 33.9

      \[\leadsto \frac{\log \color{blue}{im} \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    3. Applied simplify33.9

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

    if 3.2387365401267583e-279 < re < 7.500694230410355e-120

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

      \[\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/25.7

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

      \[\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 35.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 simplify35.5

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

    if 1.9962265802966908e+130 < re

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

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

      \[\leadsto \color{blue}{1 \cdot \frac{\log re}{\log base}}\]
  3. Recombined 5 regimes into one program.
  4. Applied simplify19.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;re \le -1.1245346812756974 \cdot 10^{+136}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;re \le -1.2961514114440863 \cdot 10^{-282}:\\ \;\;\;\;\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(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{if}\;re \le 3.2387365401267583 \cdot 10^{-279}:\\ \;\;\;\;\frac{\log base \cdot \log im}{\log base \cdot \log base}\\ \mathbf{if}\;re \le 7.500694230410355 \cdot 10^{-120}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\frac{\log base}{1}}\\ \mathbf{if}\;re \le 7.791107505106573 \cdot 10^{-91}:\\ \;\;\;\;\frac{\log base \cdot \log im}{\log base \cdot \log base}\\ \mathbf{if}\;re \le 1.9962265802966908 \cdot 10^{+130}:\\ \;\;\;\;\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(0 \cdot 0\right) \cdot \left(\log base \cdot \log base\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \end{array}}\]

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1070706311 3771791028 4128836681 4194990999 2341756049 504035650)' 
(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))))