\[\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: 18.3 s
Input Error: 32.5
Output Error: 11.6
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -3.7099458758044735 \cdot 10^{+109} \\ \frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}{\log base \cdot \log base} & \text{when } im \le 7.038626743233325 \cdot 10^{-267} \\ \frac{\log re}{\log base} & \text{when } im \le 3.664277580957564 \cdot 10^{-136} \\ \frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}{\log base \cdot \log base} & \text{when } im \le 6.29031090221932 \cdot 10^{+57} \\ \frac{\log re}{\log base} & \text{when } im \le 1.230140674236502 \cdot 10^{+103} \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -3.7099458758044735e+109

    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}\]
      52.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}}\]
      52.4
    3. Using strategy rm
      52.4
    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}}}\]
      52.5
    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}}\]
      52.5
    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}}}\]
      52.5
    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}}\]
      52.5
    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}}}\]
      52.5
    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}}}\]
      52.5
    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 \left(-1 \cdot im\right)\right)}^3}{{\left(\log base\right)}^3}}\]
      0.7
    11. Taylor expanded around -inf to get
      \[\sqrt[3]{\frac{{\left(\log \color{red}{\left(-1 \cdot im\right)}\right)}^3}{{\left(\log base\right)}^3}} \leadsto \sqrt[3]{\frac{{\left(\log \color{blue}{\left(-1 \cdot im\right)}\right)}^3}{{\left(\log base\right)}^3}}\]
      0.7
    12. Applied simplify to get
      \[\color{red}{\sqrt[3]{\frac{{\left(\log \left(-1 \cdot im\right)\right)}^3}{{\left(\log base\right)}^3}}} \leadsto \color{blue}{\frac{\log \left(-im\right)}{\log base}}\]
      0.4

    if -3.7099458758044735e+109 < im < 7.038626743233325e-267 or 3.664277580957564e-136 < im < 6.29031090221932e+57

    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}\]
      19.9
    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}}\]
      19.9
    3. Applied simplify 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}{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}}{\log base \cdot \log base}\]
      19.9

    if 7.038626743233325e-267 < im < 3.664277580957564e-136 or 6.29031090221932e+57 < im < 1.230140674236502e+103

    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}\]
      38.3
    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}}\]
      38.3
    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.3

    if 1.230140674236502e+103 < 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}\]
      51.6
    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}}\]
      51.6
    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 im + 0}{\log base \cdot \log base}\]
      0.5
    4. Taylor expanded around 0 to get
      \[\frac{\log base \cdot \log \color{red}{im} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{im} + 0}{\log base \cdot \log base}\]
      0.5
    5. Applied simplify to get
      \[\color{red}{\frac{\log base \cdot \log im + 0}{\log base \cdot \log base}} \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))))