\[\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: 22.2 s
Input Error: 31.0
Output Error: 10.5
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log base} & \text{when } re \le -6.854250489366915 \cdot 10^{+89} \\ \frac{\log \left(\sqrt{im \cdot im + {re}^2}\right)}{\log base} & \text{when } re \le -1.299410911407582 \cdot 10^{-182} \\ \frac{\log im}{\log base} & \text{when } re \le 7.525137611875435 \cdot 10^{-295} \\ \frac{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3} + 0}{\log base \cdot \log base} & \text{when } re \le 7.360638761402946 \cdot 10^{+60} \\ \frac{\log re}{\log base} & \text{otherwise} \end{cases}\)

    if re < -6.854250489366915e+89

    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}\]
      49.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}}\]
      49.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(-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.3

    if -6.854250489366915e+89 < re < -1.299410911407582e-182

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

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\frac{\log base}{\log base \cdot \log base} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right)} \leadsto \color{blue}{\frac{\log \left(\sqrt{im \cdot im + {re}^2}\right)}{\log base}}\]
      17.2

    if -1.299410911407582e-182 < re < 7.525137611875435e-295

    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.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}}\]
      29.0
    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.3

    if 7.525137611875435e-295 < re < 7.360638761402946e+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}\]
      20.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}}\]
      20.6
    3. Using strategy rm
      20.6
    4. Applied add-cbrt-cube to get
      \[\frac{\log base \cdot \color{red}{\log \left(\sqrt{{re}^2 + im \cdot im}\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\log base \cdot \color{blue}{\sqrt[3]{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3}} + 0}{\log base \cdot \log base}\]
      20.7
    5. Applied add-cbrt-cube to get
      \[\frac{\color{red}{\log base} \cdot \sqrt[3]{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{\sqrt[3]{{\left(\log base\right)}^3}} \cdot \sqrt[3]{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3} + 0}{\log base \cdot \log base}\]
      20.8
    6. Applied cbrt-unprod to get
      \[\frac{\color{red}{\sqrt[3]{{\left(\log base\right)}^3} \cdot \sqrt[3]{{\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3}} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log \left(\sqrt{{re}^2 + im \cdot im}\right)\right)}^3}} + 0}{\log base \cdot \log base}\]
      20.7

    if 7.360638761402946e+60 < 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}\]
      45.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}}\]
      45.0
    3. Using strategy rm
      45.0
    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}\]
      45.2
    5. Applied taylor to get
      \[\frac{{\left(\sqrt[3]{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right)}\right)}^3 + 0}{\log base \cdot \log base} \leadsto \frac{-1 \cdot \left(\log re \cdot \log \left(\frac{1}{base}\right)\right) + 0}{\log base \cdot \log base}\]
      0.5
    6. Taylor expanded around inf to get
      \[\frac{\color{red}{-1 \cdot \left(\log re \cdot \log \left(\frac{1}{base}\right)\right)} + 0}{\log base \cdot \log base} \leadsto \frac{\color{blue}{-1 \cdot \left(\log re \cdot \log \left(\frac{1}{base}\right)\right)} + 0}{\log base \cdot \log base}\]
      0.5
    7. Applied simplify to get
      \[\frac{-1 \cdot \left(\log re \cdot \log \left(\frac{1}{base}\right)\right) + 0}{\log base \cdot \log base} \leadsto \frac{\log re \cdot \log base}{{\left(\log base\right)}^2}\]
      0.5

    8. Applied final simplification
    9. Applied simplify to get
      \[\color{red}{\frac{\log re \cdot \log base}{{\left(\log base\right)}^2}} \leadsto \color{blue}{\frac{\log re}{\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))))