\[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
Test:
math.log10 on complex, real part
Bits:
128 bits
Bits error versus re
Bits error versus im
Time: 9.4 s
Input Error: 31.0
Output Error: 13.5
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log 10} & \text{when } re \le -2.2370754592070436 \cdot 10^{+105} \\ \frac{3}{\frac{\log 10}{\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}} & \text{when } re \le -3.221916694333817 \cdot 10^{-243} \\ \frac{\log im}{\log 10} & \text{when } re \le -2.3665634646026902 \cdot 10^{-293} \\ \frac{\log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}{\log 10} & \text{when } re \le 2.56976209479494 \cdot 10^{+109} \\ \frac{\log re}{\log 10} & \text{otherwise} \end{cases}\)

    if re < -2.2370754592070436e+105

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      50.7
    2. Applied simplify to get
      \[\color{red}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}} \leadsto \color{blue}{\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10}}\]
      50.7
    3. Applied taylor to get
      \[\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10} \leadsto \frac{\log \left(-1 \cdot re\right)}{\log 10}\]
      0.6
    4. Taylor expanded around -inf to get
      \[\frac{\log \color{red}{\left(-1 \cdot re\right)}}{\log 10} \leadsto \frac{\log \color{blue}{\left(-1 \cdot re\right)}}{\log 10}\]
      0.6
    5. Applied simplify to get
      \[\color{red}{\frac{\log \left(-1 \cdot re\right)}{\log 10}} \leadsto \color{blue}{\frac{\log \left(-re\right)}{\log 10}}\]
      0.6

    if -2.2370754592070436e+105 < re < -3.221916694333817e-243

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      19.2
    2. Applied simplify to get
      \[\color{red}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}} \leadsto \color{blue}{\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10}}\]
      19.2
    3. Using strategy rm
      19.2
    4. Applied add-cube-cbrt to get
      \[\frac{\log \color{red}{\left(\sqrt{{re}^2 + im \cdot im}\right)}}{\log 10} \leadsto \frac{\log \color{blue}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}}{\log 10}\]
      19.2
    5. Using strategy rm
      19.2
    6. Applied pow3 to get
      \[\frac{\log \color{red}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}}{\log 10} \leadsto \frac{\log \color{blue}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^{3}\right)}}{\log 10}\]
      19.2
    7. Applied log-pow to get
      \[\frac{\color{red}{\log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^{3}\right)}}{\log 10} \leadsto \frac{\color{blue}{3 \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}}{\log 10}\]
      19.3
    8. Applied associate-/l* to get
      \[\color{red}{\frac{3 \cdot \log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}{\log 10}} \leadsto \color{blue}{\frac{3}{\frac{\log 10}{\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}}}\]
      19.2

    if -3.221916694333817e-243 < re < -2.3665634646026902e-293

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      31.8
    2. Applied simplify to get
      \[\color{red}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}} \leadsto \color{blue}{\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10}}\]
      31.8
    3. Applied taylor to get
      \[\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10} \leadsto \frac{\log im}{\log 10}\]
      0.6
    4. Taylor expanded around 0 to get
      \[\frac{\log \color{red}{im}}{\log 10} \leadsto \frac{\log \color{blue}{im}}{\log 10}\]
      0.6

    if -2.3665634646026902e-293 < re < 2.56976209479494e+109

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      21.5
    2. Applied simplify to get
      \[\color{red}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}} \leadsto \color{blue}{\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10}}\]
      21.5
    3. Using strategy rm
      21.5
    4. Applied add-cube-cbrt to get
      \[\frac{\log \color{red}{\left(\sqrt{{re}^2 + im \cdot im}\right)}}{\log 10} \leadsto \frac{\log \color{blue}{\left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}}{\log 10}\]
      21.5

    if 2.56976209479494e+109 < re

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      52.5
    2. Applied simplify to get
      \[\color{red}{\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}} \leadsto \color{blue}{\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10}}\]
      52.5
    3. Applied taylor to get
      \[\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10} \leadsto \frac{\log re}{\log 10}\]
      0.6
    4. Taylor expanded around inf to get
      \[\frac{\log \color{red}{re}}{\log 10} \leadsto \frac{\log \color{blue}{re}}{\log 10}\]
      0.6

  1. Removed slow pow expressions

Original test:


(lambda ((re default) (im default))
  #:name "math.log10 on complex, real part"
  (/ (log (sqrt (+ (* re re) (* im im)))) (log 10)))