\[\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: 10.2 s
Input Error: 32.1
Output Error: 9.3
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log 10} & \text{when } re \le -3.4790326343865455 \cdot 10^{+38} \\ \frac{\log \left({\left(\sqrt[3]{\sqrt{{re}^2 + im \cdot im}}\right)}^3\right)}{\log 10} & \text{when } re \le -4.379674431420248 \cdot 10^{-198} \\ \frac{\log im}{\log 10} & \text{when } re \le 4.185543182523104 \cdot 10^{-238} \\ \frac{1}{\frac{\log 10}{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}} & \text{when } re \le 1.8039960838892567 \cdot 10^{+48} \\ \frac{\log re}{\log 10} & \text{otherwise} \end{cases}\)

    if re < -3.4790326343865455e+38

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

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

    if -4.379674431420248e-198 < re < 4.185543182523104e-238

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      30.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}}\]
      30.5
    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 4.185543182523104e-238 < re < 1.8039960838892567e+48

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      19.9
    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.9
    3. Using strategy rm
      19.9
    4. Applied clear-num to get
      \[\color{red}{\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\log 10}} \leadsto \color{blue}{\frac{1}{\frac{\log 10}{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}}}\]
      19.9

    if 1.8039960838892567e+48 < re

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