\[\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: 35.6 s
Input Error: 30.7
Output Error: 9.5
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log base} & \text{when } re \le -8.672863877351852 \cdot 10^{+91} \\ \frac{1}{\frac{\log base}{\log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}} & \text{when } re \le -3.238454026803514 \cdot 10^{-194} \\ \frac{\log im}{\log base} & \text{when } re \le 3.311585162023555 \cdot 10^{-195} \\ \frac{1}{\frac{\log base}{\log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}} & \text{when } re \le 2.9373351910676443 \cdot 10^{+99} \\ \frac{\log re}{\log base} & \text{otherwise} \end{cases}\)

    if re < -8.672863877351852e+91

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

    if -8.672863877351852e+91 < re < -3.238454026803514e-194 or 3.311585162023555e-195 < re < 2.9373351910676443e+99

    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}\]
      17.5
    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}}\]
      17.5
    3. Using strategy rm
      17.5
    4. Applied clear-num 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}{\frac{1}{\frac{\log base \cdot \log base}{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}}}\]
      17.5
    5. Applied simplify to get
      \[\frac{1}{\color{red}{\frac{\log base \cdot \log base}{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}}} \leadsto \frac{1}{\color{blue}{\frac{\log base}{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}}}\]
      17.5
    6. Using strategy rm
      17.5
    7. Applied add-cube-cbrt to get
      \[\frac{1}{\frac{\log base}{\log \color{red}{\left(\sqrt{re \cdot re + im \cdot im}\right)}}} \leadsto \frac{1}{\frac{\log base}{\log \color{blue}{\left({\left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right)}^3\right)}}}\]
      17.5
    8. Applied simplify to get
      \[\frac{1}{\frac{\log base}{\log \left({\color{red}{\left(\sqrt[3]{\sqrt{re \cdot re + im \cdot im}}\right)}}^3\right)}} \leadsto \frac{1}{\frac{\log base}{\log \left({\color{blue}{\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}}^3\right)}}\]
      17.5

    if -3.238454026803514e-194 < re < 3.311585162023555e-195

    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}\]
      31.2
    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}}\]
      31.2
    3. Using strategy rm
      31.2
    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}}\]
      31.3
    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.3

    if 2.9373351910676443e+99 < re

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

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\frac{\log re \cdot \log base}{{\left(\log base\right)}^2}} \leadsto \color{blue}{\frac{\log re}{\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))))