Average Error: 31.1 → 18.0
Time: 7.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 -6.660529274306781 \cdot 10^{+78}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;im \le -8.892800415022824 \cdot 10^{-141}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{0 \cdot 0 + \sqrt[3]{{\left(\log base \cdot \log base\right)}^{3}}}\\ \mathbf{if}\;im \le -1.4665451363801766 \cdot 10^{-175}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{if}\;im \le -6.334179832604402 \cdot 10^{-300}:\\ \;\;\;\;\sqrt[3]{\frac{\log base \cdot \log base}{{\left(\log base\right)}^{3}} \cdot {\left(\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\frac{\log base}{\sqrt[3]{\log base}}}\right)}^{3}}\\ \mathbf{if}\;im \le 1.6477040021699555 \cdot 10^{-254}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;im \le 1.0897738920777013 \cdot 10^{-216}:\\ \;\;\;\;\frac{\log base \cdot \log re}{\log base \cdot \log base}\\ \mathbf{if}\;im \le 8.004239692711746 \cdot 10^{+102}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{0 \cdot 0 + \sqrt[3]{{\left(\log base \cdot \log base\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log base \cdot \log im}{\log base \cdot \log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Derivation

  1. Split input into 7 regimes
  2. if im < -6.660529274306781e+78

    1. Initial program 47.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. Using strategy rm
    3. Applied add-cbrt-cube47.1

      \[\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 + 0 \cdot 0\right) \cdot \left(\log base \cdot \log base + 0 \cdot 0\right)\right) \cdot \left(\log base \cdot \log base + 0 \cdot 0\right)}}}\]
    4. Applied add-cbrt-cube47.2

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

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

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

      \[\leadsto \sqrt[3]{{\left(\frac{\log \color{blue}{\left(-1 \cdot im\right)}}{\frac{\log base \cdot \log base}{\log base}}\right)}^{3}}\]
    8. Applied simplify9.6

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

    if -6.660529274306781e+78 < im < -8.892800415022824e-141 or 1.0897738920777013e-216 < im < 8.004239692711746e+102

    1. Initial program 17.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. Using strategy rm
    3. Applied add-cbrt-cube18.0

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{\log base \cdot \color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}} + 0 \cdot 0}\]
    4. Applied add-cbrt-cube18.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(\log base \cdot \log base\right) \cdot \log base}} \cdot \sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base} + 0 \cdot 0}\]
    5. Applied cbrt-unprod18.0

      \[\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 \log base\right) \cdot \left(\left(\log base \cdot \log base\right) \cdot \log base\right)}} + 0 \cdot 0}\]
    6. Applied simplify18.0

      \[\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 \cdot \log base\right)}^{3}}} + 0 \cdot 0}\]

    if -8.892800415022824e-141 < im < -1.4665451363801766e-175

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

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

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

    if -1.4665451363801766e-175 < im < -6.334179832604402e-300

    1. Initial program 31.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 add-cbrt-cube31.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}{\sqrt[3]{\left(\left(\log base \cdot \log base + 0 \cdot 0\right) \cdot \left(\log base \cdot \log base + 0 \cdot 0\right)\right) \cdot \left(\log base \cdot \log base + 0 \cdot 0\right)}}}\]
    4. Applied add-cbrt-cube31.7

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

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

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base \cdot \log base}{\log base}}\right)}^{3}}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt32.0

      \[\leadsto \sqrt[3]{{\left(\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base \cdot \log base}{\color{blue}{\left(\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}\right) \cdot \sqrt[3]{\log base}}}}\right)}^{3}}\]
    9. Applied times-frac32.0

      \[\leadsto \sqrt[3]{{\left(\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\color{blue}{\frac{\log base}{\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}} \cdot \frac{\log base}{\sqrt[3]{\log base}}}}\right)}^{3}}\]
    10. Applied pow132.0

      \[\leadsto \sqrt[3]{{\left(\frac{\log \color{blue}{\left({\left(\sqrt{im \cdot im + re \cdot re}\right)}^{1}\right)}}{\frac{\log base}{\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}} \cdot \frac{\log base}{\sqrt[3]{\log base}}}\right)}^{3}}\]
    11. Applied log-pow32.0

      \[\leadsto \sqrt[3]{{\left(\frac{\color{blue}{1 \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)}}{\frac{\log base}{\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}} \cdot \frac{\log base}{\sqrt[3]{\log base}}}\right)}^{3}}\]
    12. Applied times-frac32.0

      \[\leadsto \sqrt[3]{{\color{blue}{\left(\frac{1}{\frac{\log base}{\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}}} \cdot \frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{\sqrt[3]{\log base}}}\right)}}^{3}}\]
    13. Applied unpow-prod-down32.0

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{1}{\frac{\log base}{\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}}}\right)}^{3} \cdot {\left(\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\frac{\log base}{\sqrt[3]{\log base}}}\right)}^{3}}}\]
    14. Applied simplify31.8

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

    if -6.334179832604402e-300 < im < 1.6477040021699555e-254

    1. Initial program 31.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 32.3

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

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

    if 1.6477040021699555e-254 < im < 1.0897738920777013e-216

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

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

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

    if 8.004239692711746e+102 < im

    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. Taylor expanded around 0 8.6

      \[\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 simplify8.6

      \[\leadsto \color{blue}{\frac{\log base \cdot \log im}{\log base \cdot \log base}}\]
  3. Recombined 7 regimes into one program.
  4. Applied simplify18.0

    \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;im \le -6.660529274306781 \cdot 10^{+78}:\\ \;\;\;\;\frac{\log \left(-im\right)}{\log base}\\ \mathbf{if}\;im \le -8.892800415022824 \cdot 10^{-141}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{0 \cdot 0 + \sqrt[3]{{\left(\log base \cdot \log base\right)}^{3}}}\\ \mathbf{if}\;im \le -1.4665451363801766 \cdot 10^{-175}:\\ \;\;\;\;\frac{\log re}{\log base}\\ \mathbf{if}\;im \le -6.334179832604402 \cdot 10^{-300}:\\ \;\;\;\;\sqrt[3]{\frac{\log base \cdot \log base}{{\left(\log base\right)}^{3}} \cdot {\left(\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\frac{\log base}{\sqrt[3]{\log base}}}\right)}^{3}}\\ \mathbf{if}\;im \le 1.6477040021699555 \cdot 10^{-254}:\\ \;\;\;\;\frac{\log \left(-re\right)}{\log base}\\ \mathbf{if}\;im \le 1.0897738920777013 \cdot 10^{-216}:\\ \;\;\;\;\frac{\log base \cdot \log re}{\log base \cdot \log base}\\ \mathbf{if}\;im \le 8.004239692711746 \cdot 10^{+102}:\\ \;\;\;\;\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base + \tan^{-1}_* \frac{im}{re} \cdot 0}{0 \cdot 0 + \sqrt[3]{{\left(\log base \cdot \log base\right)}^{3}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log base \cdot \log im}{\log base \cdot \log base}\\ \end{array}}\]

Runtime

Time bar (total: 7.8m)Debug logProfile

herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' 
(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))))