\[\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: 17.0 s
Input Error: 15.1
Output Error: 6.6
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -9.2381495f+10 \\ \frac{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^{1} + 0}{\log base \cdot \log base} & \text{when } im \le 3.2481306f+11 \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -9.2381495f+10

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

    11. Applied final simplification
    12. Applied simplify to get
      \[\color{red}{\frac{\log \left(-im\right) \cdot \log base}{\log base \cdot \log base}} \leadsto \color{blue}{\frac{\log \left(-im\right)}{\log base}}\]
      0.4

    if -9.2381495f+10 < im < 3.2481306f+11

    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}\]
      10.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}}\]
      10.1
    3. Using strategy rm
      10.1
    4. Applied pow1 to get
      \[\frac{\log base \cdot \color{red}{\log \left(\sqrt{{re}^2 + im \cdot im}\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \color{blue}{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^{1}} + 0}{\log base \cdot \log base}\]
      10.1
    5. Applied pow1 to get
      \[\frac{\color{red}{\log base} \cdot {\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^{1} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{{\left(\log base\right)}^{1}} \cdot {\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^{1} + 0}{\log base \cdot \log base}\]
      10.1
    6. Applied pow-prod-down to get
      \[\frac{\color{red}{{\left(\log base\right)}^{1} \cdot {\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^{1}} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^{1}} + 0}{\log base \cdot \log base}\]
      10.2

    if 3.2481306f+11 < 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}\]
      24.0
    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}}\]
      24.0
    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.4
    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.4
    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))))