\[\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.5 s
Input Error: 32.5
Output Error: 9.4
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log base} & \text{when } re \le -4.990674843592913 \cdot 10^{+108} \\ \frac{1}{\log \left(e^{\frac{\log base}{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}}\right)} & \text{when } re \le -3.965426564809338 \cdot 10^{-197} \\ \frac{\log im}{\log base} & \text{when } re \le 2.2020111063384302 \cdot 10^{-197} \\ \log \left(e^{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right)}{\log base}}\right) & \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} \\ \log \left(e^{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right)}{\log base}}\right) & \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 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}}}\]
      18.0
    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.9
    6. Using strategy rm
      17.9
    7. Applied add-log-exp to get
      \[\frac{1}{\color{red}{\frac{\log base}{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}}} \leadsto \frac{1}{\color{blue}{\log \left(e^{\frac{\log base}{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}}\right)}}\]
      18.3

    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.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}}\]
      29.6
    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.5
    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.5
    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.4

    if 2.2020111063384302e-197 < re < 2.9308959747651406e-60

    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}\]
      19.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}}\]
      19.6
    3. Using strategy rm
      19.6
    4. Applied add-log-exp 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}{\log \left(e^{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\right)}\]
      19.9
    5. Applied simplify to get
      \[\log \color{red}{\left(e^{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base \cdot \log base}}\right)} \leadsto \log \color{blue}{\left(e^{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}}\right)}\]
      19.8
    6. Applied simplify to get
      \[\log \left(e^{\color{red}{\frac{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}{\log base}}}\right) \leadsto \log \left(e^{\color{blue}{\frac{\log \left(\sqrt{{im}^2 + re \cdot re}\right)}{\log base}}}\right)\]
      19.8

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

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