\[\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.3 s
Input Error: 15.3
Output Error: 6.3
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -200.41609f0 \\ \frac{{\left(\sqrt[3]{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right)}\right)}^3 + 0}{\log base \cdot \log base} & \text{when } im \le 2.6527427f+10 \\ \frac{\log base \cdot \log im}{\log base \cdot \log base} & \text{otherwise} \end{cases}\)

    if im < -200.41609f0

    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}\]
      21.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}}\]
      21.0
    3. Using strategy rm
      21.0
    4. Applied add-cube-cbrt 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[3]{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\right)}^3}\]
      21.1
    5. Applied simplify to get
      \[{\color{red}{\left(\sqrt[3]{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\right)}}^3 \leadsto {\color{blue}{\left(\sqrt[3]{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}}\right)}}^3\]
      21.1
    6. Applied taylor to get
      \[{\left(\sqrt[3]{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}}\right)}^3 \leadsto {\left(\sqrt[3]{\frac{\log \left(-1 \cdot im\right)}{\log base}}\right)}^3\]
      0.8
    7. Taylor expanded around -inf to get
      \[{\left(\sqrt[3]{\frac{\log \color{red}{\left(-1 \cdot im\right)}}{\log base}}\right)}^3 \leadsto {\left(\sqrt[3]{\frac{\log \color{blue}{\left(-1 \cdot im\right)}}{\log base}}\right)}^3\]
      0.8
    8. Applied simplify to get
      \[{\left(\sqrt[3]{\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 -200.41609f0 < im < 2.6527427f+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}\]
      10.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}}\]
      10.4
    3. Using strategy rm
      10.4
    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}\]
      10.7

    if 2.6527427f+10 < 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}\]
      23.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}}\]
      23.2
    3. Using strategy rm
      23.2
    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}}}\]
      23.2
    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}}\]
      23.2
    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}}}\]
      23.2
    7. Applied taylor to get
      \[\frac{\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{\log base \cdot \log im + 0}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}\]
      0.4
    8. Taylor expanded around 0 to get
      \[\frac{\log base \cdot \log \color{red}{im} + 0}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}} \leadsto \frac{\log base \cdot \log \color{blue}{im} + 0}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}\]
      0.4
    9. Applied simplify to get
      \[\frac{\log base \cdot \log im + 0}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}} \leadsto \frac{\log im \cdot \log base}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}\]
      0.4

    10. Applied final simplification
    11. Applied simplify to get
      \[\color{red}{\frac{\log im \cdot \log base}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}} \leadsto \color{blue}{\frac{\log base \cdot \log im}{\log base \cdot \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))))