\[\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.5 s
Input Error: 30.4
Output Error: 14.1
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log 10} & \text{when } re \le -7.515261356325578 \cdot 10^{+104} \\ \frac{\log \left({\left(e^{\log \left(\sqrt[3]{e^{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}}\right)}\right)}^3\right)}{\log 10} & \text{when } re \le 4.3827392081136433 \cdot 10^{+102} \\ \frac{\log re}{\log 10} & \text{otherwise} \end{cases}\)

    if re < -7.515261356325578e+104

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      51.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}}\]
      51.8
    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 -7.515261356325578e+104 < re < 4.3827392081136433e+102

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      20.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}}\]
      20.5
    3. Using strategy rm
      20.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}\]
      20.5
    5. Using strategy rm
      20.5
    6. Applied add-exp-log to get
      \[\frac{\log \left({\color{red}{\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}}^3\right)}{\log 10} \leadsto \frac{\log \left({\color{blue}{\left(e^{\log \left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}\right)}}^3\right)}{\log 10}\]
      20.5
    7. Using strategy rm
      20.5
    8. Applied add-exp-log to get
      \[\frac{\log \left({\left(e^{\log \left(\sqrt[3]{\color{red}{\sqrt{{re}^2 + im \cdot im}}}\right)}\right)}^3\right)}{\log 10} \leadsto \frac{\log \left({\left(e^{\log \left(\sqrt[3]{\color{blue}{e^{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}}}\right)}\right)}^3\right)}{\log 10}\]
      20.5

    if 4.3827392081136433e+102 < re

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      51.0
    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}}\]
      51.0
    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)))