Average Error: 30.8 → 18.1
Time: 27.4s
Precision: 64
Internal Precision: 576
\[\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.1373385988151778 \cdot 10^{+84}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le -8.914818609317095 \cdot 10^{-200}:\\ \;\;\;\;\sqrt[3]{{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right)\right)}^{3} \cdot \frac{\log base \cdot \log base}{\frac{{\left(\log base\right)}^{6}}{\log base}}}\\ \mathbf{elif}\;re \le 6.781942799220377 \cdot 10^{-147}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 1.3391851730977554 \cdot 10^{+131}:\\ \;\;\;\;\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log base \cdot \log re}{\log base \cdot \log base}\\ \end{array}\]

Error

Bits error versus re

Bits error versus im

Bits error versus base

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 5 regimes
  2. if re < -1.1373385988151778e+84

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

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube46.0

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}}\]
    5. Applied add-cbrt-cube46.0

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\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}}\]
    6. Applied cbrt-unprod46.0

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\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)}}}\]
    7. Simplified46.0

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

      \[\leadsto \color{blue}{-1 \cdot \frac{\log \left(\frac{-1}{re}\right)}{\log -1 - \log \left(\frac{-1}{base}\right)}}\]
    9. Simplified9.3

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

    if -1.1373385988151778e+84 < re < -8.914818609317095e-200

    1. Initial program 18.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. Initial simplification18.2

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied add-cbrt-cube18.4

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \color{blue}{\sqrt[3]{\left(\log base \cdot \log base\right) \cdot \log base}}}\]
    5. Applied add-cbrt-cube18.6

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\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}}\]
    6. Applied cbrt-unprod18.4

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\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)}}}\]
    7. Simplified18.4

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\sqrt[3]{\color{blue}{{\left(\log base\right)}^{6}}}}\]
    8. Using strategy rm
    9. Applied add-cbrt-cube18.5

      \[\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)}}}{\sqrt[3]{{\left(\log base\right)}^{6}}}\]
    10. Applied cbrt-undiv18.4

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\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)}{{\left(\log base\right)}^{6}}}}\]
    11. Simplified18.4

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

    if -8.914818609317095e-200 < re < 6.781942799220377e-147

    1. Initial program 31.3

      \[\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. Initial simplification31.3

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

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

    if 6.781942799220377e-147 < re < 1.3391851730977554e+131

    1. Initial program 15.5

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

      \[\leadsto \frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base}{\log base \cdot \log base}\]
    3. Using strategy rm
    4. Applied div-inv15.6

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

    if 1.3391851730977554e+131 < re

    1. Initial program 55.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. Initial simplification55.2

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

      \[\leadsto \frac{\color{blue}{\log \left(\frac{1}{base}\right) \cdot \log \left(\frac{1}{re}\right)}}{\log base \cdot \log base}\]
    4. Simplified6.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;re \le -1.1373385988151778 \cdot 10^{+84}:\\ \;\;\;\;\frac{-1}{\log base} \cdot \log \left(\frac{-1}{re}\right)\\ \mathbf{elif}\;re \le -8.914818609317095 \cdot 10^{-200}:\\ \;\;\;\;\sqrt[3]{{\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right)\right)}^{3} \cdot \frac{\log base \cdot \log base}{\frac{{\left(\log base\right)}^{6}}{\log base}}}\\ \mathbf{elif}\;re \le 6.781942799220377 \cdot 10^{-147}:\\ \;\;\;\;\frac{\log im}{\log base}\\ \mathbf{elif}\;re \le 1.3391851730977554 \cdot 10^{+131}:\\ \;\;\;\;\left(\log \left(\sqrt{re \cdot re + im \cdot im}\right) \cdot \log base\right) \cdot \frac{1}{\log base \cdot \log base}\\ \mathbf{else}:\\ \;\;\;\;\frac{\log base \cdot \log re}{\log base \cdot \log base}\\ \end{array}\]

Runtime

Time bar (total: 27.4s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes30.818.17.223.753.7%
herbie shell --seed 2018297 
(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))))