Average Error: 31.1 → 17.8
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 -2.260134988712712 \cdot 10^{+61}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{if}\;-re \le -2.250949059605938 \cdot 10^{-230}:\\ \;\;\;\;\frac{\sqrt[3]{{\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}^{3}} + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\\ \mathbf{if}\;-re \le 3.9842002880140432 \cdot 10^{-230}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;-re \le 2.734456725077846 \cdot 10^{+92}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\sqrt[3]{{\left(\log base\right)}^{3} \cdot {\left(\log base\right)}^{3}} + 0 \cdot 0}\\ \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 5 regimes
  2. if (- re) < -2.260134988712712e+61

    1. Initial program 45.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 10.3

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

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

    if -2.260134988712712e+61 < (- re) < -2.250949059605938e-230

    1. Initial program 19.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 add-cbrt-cube20.0

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

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

    if -2.250949059605938e-230 < (- re) < 3.9842002880140432e-230

    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. Using strategy rm
    3. Applied add-cbrt-cube31.3

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

      \[\leadsto \frac{\sqrt[3]{\color{blue}{{\left(\log base \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}^{3}}} + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \log base + 0 \cdot 0}\]
    5. Taylor expanded around -inf 34.0

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

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

    if 3.9842002880140432e-230 < (- re) < 2.734456725077846e+92

    1. Initial program 19.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 add-cbrt-cube19.2

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

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

    if 2.734456725077846e+92 < (- re)

    1. Initial program 47.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 10.0

      \[\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 simplify9.9

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

Runtime

Time bar (total: 1.1m)Debug logProfile

herbie shell --seed '#(1064300848 3212030778 2049303162 3567222883 2277747821 1384278011)' 
(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))))