\[\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: 20.2 s
Input Error: 31.0
Output Error: 13.7
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-im\right)}{\log base} & \text{when } im \le -8.193549540332154 \cdot 10^{+140} \\ \sqrt[3]{\frac{{\left(\log \left(\sqrt{{im}^2 + re \cdot re}\right)\right)}^3}{{\left(\log base\right)}^3}} & \text{when } im \le 5.11104370095671 \cdot 10^{-307} \\ \frac{\log \left(-re\right)}{\log base} & \text{when } im \le 2.9099428310613175 \cdot 10^{-275} \\ \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right) \cdot \frac{1}{\log base \cdot \log base} & \text{when } im \le 1.3135365250902935 \cdot 10^{+68} \\ \frac{\log im}{\log base} & \text{otherwise} \end{cases}\)

    if im < -8.193549540332154e+140

    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}\]
      59.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}}\]
      59.0
    3. Using strategy rm
      59.0
    4. Applied *-un-lft-identity 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}{1 \cdot \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}}{\log base \cdot \log base}\]
      59.0
    5. Applied times-frac to get
      \[\color{red}{\frac{1 \cdot \left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}{\log base \cdot \log base}} \leadsto \color{blue}{\frac{1}{\log base} \cdot \frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base}}\]
      59.0
    6. Applied simplify to get
      \[\frac{1}{\log base} \cdot \color{red}{\frac{\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0}{\log base}} \leadsto \frac{1}{\log base} \cdot \color{blue}{\log \left(\sqrt{im \cdot im + re \cdot re}\right)}\]
      59.0
    7. Applied taylor to get
      \[\frac{1}{\log base} \cdot \log \left(\sqrt{im \cdot im + re \cdot re}\right) \leadsto \frac{1}{\log base} \cdot \log \left(-1 \cdot im\right)\]
      0.4
    8. Taylor expanded around -inf to get
      \[\frac{1}{\log base} \cdot \log \color{red}{\left(-1 \cdot im\right)} \leadsto \frac{1}{\log base} \cdot \log \color{blue}{\left(-1 \cdot im\right)}\]
      0.4
    9. Applied simplify to get
      \[\color{red}{\frac{1}{\log base} \cdot \log \left(-1 \cdot im\right)} \leadsto \color{blue}{\frac{\log \left(-im\right)}{\log base}}\]
      0.3

    if -8.193549540332154e+140 < im < 5.11104370095671e-307

    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.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}}\]
      20.8
    3. Using strategy rm
      20.8
    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}}}\]
      21.0
    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}}\]
      21.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}}}\]
      21.0
    7. Applied add-cbrt-cube to get
      \[\frac{\color{red}{\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{\color{blue}{\sqrt[3]{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}}}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}\]
      21.1
    8. Applied cbrt-undiv to get
      \[\color{red}{\frac{\sqrt[3]{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}}{\sqrt[3]{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}} \leadsto \color{blue}{\sqrt[3]{\frac{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}}\]
      21.0
    9. Applied simplify to get
      \[\sqrt[3]{\color{red}{\frac{{\left(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right)}^3}{{\left(\log base\right)}^3 \cdot {\left(\log base\right)}^3}}} \leadsto \sqrt[3]{\color{blue}{\frac{{\left(\log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}^3}{{\left(\log base\right)}^3}}}\]
      21.0
    10. Applied simplify to get
      \[\sqrt[3]{\frac{\color{red}{{\left(\log \left(\sqrt{im \cdot im + re \cdot re}\right)\right)}^3}}{{\left(\log base\right)}^3}} \leadsto \sqrt[3]{\frac{\color{blue}{{\left(\log \left(\sqrt{{im}^2 + re \cdot re}\right)\right)}^3}}{{\left(\log base\right)}^3}}\]
      21.0

    if 5.11104370095671e-307 < im < 2.9099428310613175e-275

    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}\]
      33.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}}\]
      33.8
    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 2.9099428310613175e-275 < im < 1.3135365250902935e+68

    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.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}}\]
      20.3
    3. Using strategy rm
      20.3
    4. Applied div-inv 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(\log base \cdot \log \left(\sqrt{{re}^2 + im \cdot im}\right) + 0\right) \cdot \frac{1}{\log base \cdot \log base}}\]
      20.3

    if 1.3135365250902935e+68 < 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}\]
      46.9
    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}}\]
      46.9
    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

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