\[\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: 29.7 s
Input Error: 32.5
Output Error: 9.3
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log base} & \text{when } re \le -4.990674843592913 \cdot 10^{+108} \\ \frac{\log base \cdot \log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right) + 0}{\log base \cdot \log base} & \text{when } re \le -3.965426564809338 \cdot 10^{-197} \\ \frac{\log im}{\log base} + \frac{\frac{1}{2}}{\log base} \cdot {\left(\frac{re}{im}\right)}^2 & \text{when } re \le 2.2020111063384302 \cdot 10^{-197} \\ \frac{\log base \cdot \log \left({\left({\left(\sqrt{{re}^2 + im \cdot im}\right)}^{\frac{1}{3}}\right)}^3\right) + 0}{\log base \cdot \log base} & \text{when } re \le 2.9308959747651406 \cdot 10^{-60} \\ \frac{\log \left(-im\right)}{\log base} & \text{when } re \le 1.1318552232567758 \cdot 10^{+17} \\ \frac{\log base \cdot \log \left({\left({\left(\sqrt{{re}^2 + im \cdot im}\right)}^{\frac{1}{3}}\right)}^3\right) + 0}{\log base \cdot \log base} & \text{when } re \le 1.432799947628018 \cdot 10^{+112} \\ \frac{\log re}{\log base} & \text{otherwise} \end{cases}\)

    if re < -4.990674843592913e+108

    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}\]
      51.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}}\]
      51.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 \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 -4.990674843592913e+108 < re < -3.965426564809338e-197

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

    if -3.965426564809338e-197 < re < 2.2020111063384302e-197

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

    9. Applied final simplification

    if 2.2020111063384302e-197 < re < 2.9308959747651406e-60 or 1.1318552232567758e+17 < re < 1.432799947628018e+112

    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}\]
      18.6
    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}}\]
      18.6
    3. Using strategy rm
      18.6
    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}\]
      18.6
    5. Using strategy rm
      18.6
    6. Applied pow1/3 to get
      \[\frac{\log base \cdot \log \left({\color{red}{\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}}^3\right) + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \log \left({\color{blue}{\left({\left(\sqrt{{re}^2 + im \cdot im}\right)}^{\frac{1}{3}}\right)}}^3\right) + 0}{\log base \cdot \log base}\]
      18.7

    if 2.9308959747651406e-60 < re < 1.1318552232567758e+17

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

    if 1.432799947628018e+112 < 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}\]
      52.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}}\]
      52.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 re + 0}{\log base \cdot \log base}\]
      0.5
    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.5
    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))))