\[\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: 6.8 s
Input Error: 14.7
Output Error: 6.3
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log 10} & \text{when } re \le -7.1884515f+13 \\ \frac{\log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}{\log 10} & \text{when } re \le 1.5542767f+09 \\ \frac{\log re}{\log 10} & \text{otherwise} \end{cases}\)

    if re < -7.1884515f+13

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

    if -7.1884515f+13 < re < 1.5542767f+09

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

    if 1.5542767f+09 < re

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      23.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}}\]
      23.2
    3. Applied taylor to get
      \[\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10} \leadsto \frac{\log re}{\log 10}\]
      0.3
    4. Taylor expanded around inf to get
      \[\frac{\log \color{red}{re}}{\log 10} \leadsto \frac{\log \color{blue}{re}}{\log 10}\]
      0.3

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