\[\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: 14.5 s
Input Error: 30.4
Output Error: 13.9
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -1.3639623149762622 \cdot 10^{+140} \\ \frac{1}{\log base} \cdot \log \left(\sqrt{{im}^2 + re \cdot re}\right) & \text{when } im \le 2.56976209479494 \cdot 10^{+109} \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -1.3639623149762622e+140

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

    9. Applied final simplification

    if -1.3639623149762622e+140 < im < 2.56976209479494e+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}\]
      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. Using strategy rm
      19.9
    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}\]
      19.9
    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}}\]
      19.9
    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)}\]
      19.9
    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)}\]
      19.9

    if 2.56976209479494e+109 < 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}\]
      50.7
    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}}\]
      50.7
    3. Using strategy rm
      50.7
    4. Applied div-inv to get
      \[\color{red}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}} \leadsto \color{blue}{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right) \cdot \frac{1}{\log base \cdot \log base}}\]
      50.7
    5. Applied taylor to get
      \[\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right) \cdot \frac{1}{\log base \cdot \log base} \leadsto \left(\log base \cdot \log im + 0\right) \cdot \frac{1}{\log base \cdot \log base}\]
      0.5
    6. Taylor expanded around 0 to get
      \[\left(\log base \cdot \log \color{red}{im} + 0\right) \cdot \frac{1}{\log base \cdot \log base} \leadsto \left(\log base \cdot \log \color{blue}{im} + 0\right) \cdot \frac{1}{\log base \cdot \log base}\]
      0.5
    7. Applied simplify to get
      \[\left(\log base \cdot \log im + 0\right) \cdot \frac{1}{\log base \cdot \log base} \leadsto \frac{\log im \cdot \log base}{\log base \cdot \log base}\]
      0.5

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\frac{\log im \cdot \log base}{\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))))