\[\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: 21.3 s
Input Error: 15.9
Output Error: 3.4
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log base} & \text{when } re \le -5.5866455f+09 \\ \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}} & \text{when } re \le -1.5735045f-29 \\ \frac{\log \left(-im\right)}{\log base} & \text{when } re \le 3.3031373f-09 \\ \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}} & \text{when } re \le 13.069779f0 \\ \frac{\log re}{\log base} & \text{otherwise} \end{cases}\)

    if re < -5.5866455f+09

    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.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}}\]
      23.1
    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.4
    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.4
    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 -5.5866455f+09 < re < -1.5735045f-29 or 3.3031373f-09 < re < 13.069779f0

    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}\]
      8.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}}\]
      8.7
    3. Using strategy rm
      8.7
    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}}}\]
      8.7
    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}}\]
      8.7
    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}}}\]
      8.8

    if -1.5735045f-29 < re < 3.3031373f-09

    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}\]
      14.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}}\]
      14.1
    3. Using strategy rm
      14.1
    4. Applied add-cube-cbrt 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}{{\left(\sqrt[3]{\log base}\right)}^3}}\]
      14.3
    5. 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 {\left(\sqrt[3]{\log base}\right)}^3} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{{\left(\sqrt[3]{\log base}\right)}^3} \cdot {\left(\sqrt[3]{\log base}\right)}^3}\]
      14.5
    6. Applied cube-unprod to get
      \[\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{red}{{\left(\sqrt[3]{\log base}\right)}^3 \cdot {\left(\sqrt[3]{\log base}\right)}^3}} \leadsto \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\color{blue}{{\left(\sqrt[3]{\log base} \cdot \sqrt[3]{\log base}\right)}^3}}\]
      14.5
    7. 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 \sqrt[3]{\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 \sqrt[3]{\log base}\right)}^3}\]
      14.6
    8. 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 \sqrt[3]{\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 \sqrt[3]{\log base}}\right)}^3}\]
      14.6
    9. 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 \sqrt[3]{\log base}}\right)}}^3 \leadsto {\color{blue}{\left(\frac{\sqrt[3]{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}}{{\left(\sqrt[3]{\log base}\right)}^2}\right)}}^3\]
      14.6
    10. Applied taylor to get
      \[{\left(\frac{\sqrt[3]{\log \left(\sqrt{im \cdot im + re \cdot re}\right) \cdot \log base}}{{\left(\sqrt[3]{\log base}\right)}^2}\right)}^3 \leadsto {\left(\frac{\sqrt[3]{\log \left(-1 \cdot im\right) \cdot \log base}}{{\left(\sqrt[3]{\log base}\right)}^2}\right)}^3\]
      1.4
    11. Taylor expanded around -inf to get
      \[{\left(\frac{\sqrt[3]{\log \color{red}{\left(-1 \cdot im\right)} \cdot \log base}}{{\left(\sqrt[3]{\log base}\right)}^2}\right)}^3 \leadsto {\left(\frac{\sqrt[3]{\log \color{blue}{\left(-1 \cdot im\right)} \cdot \log base}}{{\left(\sqrt[3]{\log base}\right)}^2}\right)}^3\]
      1.4
    12. Applied simplify to get
      \[{\left(\frac{\sqrt[3]{\log \left(-1 \cdot im\right) \cdot \log base}}{{\left(\sqrt[3]{\log base}\right)}^2}\right)}^3 \leadsto \frac{\log base}{\log base} \cdot \frac{\log \left(-im\right)}{\log base}\]
      0.3

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

    if 13.069779f0 < 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}\]
      20.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}}\]
      20.5
    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 re + 0}{\log base \cdot \log base}\]
      0.4
    4. Taylor expanded around inf to get
      \[\frac{\log base \cdot \log \color{red}{re} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \color{blue}{re} + 0}{\log base \cdot \log base}\]
      0.4
    5. Applied simplify to get
      \[\color{red}{\frac{\log base \cdot \log re + 0}{\log base \cdot \log base}} \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))))