\[\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}\]
Test:
math.log/2 on complex, real part
Bits:
128 bits
Bits error versus re
Bits error versus im
Bits error versus base
Time: 16.9 s
Input Error: 31.5
Output Error: 11.5
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -1.3332286348368804 \cdot 10^{+80} \\ \frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right)}{\log base} & \text{when } im \le -5.921293819111615 \cdot 10^{-253} \\ \frac{\log re}{\log base} & \text{when } im \le 3.3840698766986167 \cdot 10^{-220} \\ \frac{1}{\log base} \cdot \log \left(\sqrt{{im}^2 + re \cdot re}\right) & \text{when } im \le 6.609434999445627 \cdot 10^{+128} \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -1.3332286348368804e+80

    1. Started with
      \[\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}\]
      48.4
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      48.4
    3. Applied taylor to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{{\left(\log base\right)}^2}\]
      48.4
    4. Taylor expanded around 0 to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{{\left(\log base\right)}^2}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{{\left(\log base\right)}^2}}\]
      48.4
    5. Applied simplify to get
      \[\color{red}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{{\left(\log base\right)}^2}} \leadsto \color{blue}{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}}\]
      48.4
    6. Applied taylor to get
      \[\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base} \leadsto \frac{\log \left(-1 \cdot im\right)}{\log base}\]
      0.4
    7. Taylor expanded around -inf to get
      \[\frac{\log \color{red}{\left(-1 \cdot im\right)}}{\log base} \leadsto \frac{\log \color{blue}{\left(-1 \cdot im\right)}}{\log base}\]
      0.4
    8. Applied simplify to get
      \[\color{red}{\frac{\log \left(-1 \cdot im\right)}{\log base}} \leadsto \color{blue}{\frac{\log \left(-im\right)}{\log base}}\]
      0.4

    if -1.3332286348368804e+80 < im < -5.921293819111615e-253

    1. Started with
      \[\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}\]
      21.1
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      21.1
    3. Applied taylor to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{{\left(\log base\right)}^2}\]
      21.1
    4. Taylor expanded around 0 to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{{\left(\log base\right)}^2}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{{\left(\log base\right)}^2}}\]
      21.1
    5. Applied simplify to get
      \[\color{red}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{{\left(\log base\right)}^2}} \leadsto \color{blue}{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}}\]
      21.0
    6. Applied simplify to get
      \[\frac{\color{red}{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}}{\log base} \leadsto \frac{\color{blue}{\log \left(\sqrt{{im}^2 + re \cdot re}\right)}}{\log base}\]
      21.0

    if -5.921293819111615e-253 < im < 3.3840698766986167e-220

    1. Started with
      \[\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}\]
      29.4
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      29.4
    3. Applied taylor to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log re + 0}{\log base \cdot \log base}\]
      0.5
    4. Taylor expanded around inf to get
      \[\frac{\log base \cdot \log \color{red}{re} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{re} + 0}{\log base \cdot \log base}\]
      0.5
    5. Applied simplify to get
      \[\color{red}{\frac{\log base \cdot \log re + 0}{\log base \cdot \log base}} \leadsto \color{blue}{\frac{\log re}{\log base}}\]
      0.4

    if 3.3840698766986167e-220 < im < 6.609434999445627e+128

    1. Started with
      \[\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}\]
      18.1
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      18.1
    3. Using strategy rm
      18.1
    4. Applied *-un-lft-identity to get
      \[\frac{\color{red}{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}}{\log base \cdot \log base} \leadsto \frac{\color{blue}{1 \cdot \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}}{\log base \cdot \log base}\]
      18.1
    5. Applied times-frac to get
      \[\color{red}{\frac{1 \cdot \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}{\log base \cdot \log base}} \leadsto \color{blue}{\frac{1}{\log base} \cdot \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base}}\]
      18.1
    6. Applied simplify to get
      \[\frac{1}{\log base} \cdot \color{red}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base}} \leadsto \frac{1}{\log base} \cdot \color{blue}{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}\]
      18.1
    7. Applied simplify to get
      \[\frac{1}{\log base} \cdot \log \color{red}{\left(\sqrt{im \cdot im + re \cdot re}\right)} \leadsto \frac{1}{\log base} \cdot \log \color{blue}{\left(\sqrt{{im}^2 + re \cdot re}\right)}\]
      18.1

    if 6.609434999445627e+128 < im

    1. Started with
      \[\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}\]
      55.1
    2. Applied simplify to get
      \[\color{red}{\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}} \leadsto \color{blue}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\]
      55.1
    3. Using strategy rm
      55.1
    4. Applied add-cbrt-cube to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \color{red}{\log base}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \color{blue}{\sqrt[3]{{\left(\log base\right)}^3}}}\]
      55.1
    5. Applied add-cbrt-cube to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{\log base} \cdot \sqrt[3]{{\left(\log base\right)}^3}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{\sqrt[3]{{\left(\log base\right)}^3}} \cdot \sqrt[3]{{\left(\log base\right)}^3}}\]
      55.2
    6. Applied cbrt-unprod to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{\sqrt[3]{{\left(\log base\right)}^3} \cdot \sqrt[3]{{\left(\log base\right)}^3}}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}}\]
      55.1
    7. Applied add-cbrt-cube to get
      \[\frac{\color{red}{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}} \leadsto \frac{\color{blue}{\sqrt[3]{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}}}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}\]
      55.1
    8. Applied cbrt-undiv to get
      \[\color{red}{\frac{\sqrt[3]{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}} \leadsto \color{blue}{\sqrt[3]{\frac{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}}\]
      55.1
    9. Applied simplify to get
      \[\sqrt[3]{\color{red}{\frac{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}} \leadsto \sqrt[3]{\color{blue}{\frac{{\left(\log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}^3}{{\left(\log base\right)}^3}}}\]
      55.1
    10. Applied taylor to get
      \[\sqrt[3]{\frac{{\left(\log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}^3}{{\left(\log base\right)}^3}} \leadsto \sqrt[3]{\frac{{\left(\log im\right)}^3}{{\left(\log base\right)}^3}}\]
      0.6
    11. Taylor expanded around inf to get
      \[\sqrt[3]{\frac{{\left(\log \color{red}{im}\right)}^3}{{\left(\log base\right)}^3}} \leadsto \sqrt[3]{\frac{{\left(\log \color{blue}{im}\right)}^3}{{\left(\log base\right)}^3}}\]
      0.6
    12. Applied simplify to get
      \[\sqrt[3]{\frac{{\left(\log im\right)}^3}{{\left(\log base\right)}^3}} \leadsto \sqrt[3]{\frac{{\left(\log im\right)}^3}{{\left(\log base\right)}^3}}\]
      0.6

    13. Applied final simplification
    14. Applied simplify to get
      \[\color{red}{\sqrt[3]{\frac{{\left(\log im\right)}^3}{{\left(\log base\right)}^3}}} \leadsto \color{blue}{\frac{\log im}{\log base}}\]
      0.4

  1. Removed slow pow expressions

Original test:


(lambda ((re default) (im default) (base default))
  #: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))))