\[\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: 20.6 s
Input Error: 14.7
Output Error: 6.9
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -8.943399f+18 \\ \frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log \left(\sqrt[3]{\sqrt{{im}^2 + re \cdot re}}\right) \cdot \left(\log base + \log base\right)\right) + 0}{\log base \cdot \log base} & \text{when } im \le 7.8802614f+18 \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -8.943399f+18

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

    9. Applied final simplification

    if -8.943399f+18 < im < 7.8802614f+18

    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}\]
      9.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}}\]
      9.2
    3. Using strategy rm
      9.2
    4. Applied add-cube-cbrt to get
      \[\frac{\log base \cdot \log \color{red}{\left(\sqrt{{re}^2 + im \cdot im}\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)} + 0}{\log base \cdot \log base}\]
      9.3
    5. Using strategy rm
      9.3
    6. Applied cube-mult to get
      \[\frac{\log base \cdot \log \color{red}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base}\]
      9.3
    7. Applied log-prod to get
      \[\frac{\log base \cdot \color{red}{\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \color{blue}{\left(\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base}\]
      9.2
    8. Applied distribute-lft-in to get
      \[\frac{\color{red}{\log base \cdot \left(\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)\right)} + 0}{\log base \cdot \log base}\]
      9.2
    9. Applied simplify to get
      \[\frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{red}{\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}} \cdot \sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}\right) + 0}{\log base \cdot \log base} \leadsto \frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{blue}{\log \left(\sqrt[3]{\sqrt{im \cdot im + re \cdot re}}\right) \cdot \left(\log base + \log base\right)}\right) + 0}{\log base \cdot \log base}\]
      9.3
    10. Applied simplify to get
      \[\frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{red}{\log \left(\sqrt[3]{\sqrt{im \cdot im + re \cdot re}}\right)} \cdot \left(\log base + \log base\right)\right) + 0}{\log base \cdot \log base} \leadsto \frac{\left(\log base \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right) + \color{blue}{\log \left(\sqrt[3]{\sqrt{{im}^2 + re \cdot re}}\right)} \cdot \left(\log base + \log base\right)\right) + 0}{\log base \cdot \log base}\]
      9.3

    if 7.8802614f+18 < 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}\]
      29.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}}\]
      29.7
    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.3
    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.3
    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.3

  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))))