\[\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: 14.8
Output Error: 6.4
Log:
Profile: 🕒
\(\begin{cases} \frac{\log \left(-re\right)}{\log 10} & \text{when } re \le -4.0233915f+09 \\ \frac{\frac{1}{2}}{1} \cdot \frac{\log \left({re}^2 + im \cdot im\right)}{\log 10} & \text{when } re \le 1.1667896f+15 \\ \frac{\log re}{\log 10} & \text{otherwise} \end{cases}\)

    if re < -4.0233915f+09

    1. Started with
      \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
      23.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}}\]
      23.5
    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 -4.0233915f+09 < re < 1.1667896f+15

    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 *-un-lft-identity to get
      \[\frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\color{red}{\log 10}} \leadsto \frac{\log \left(\sqrt{{re}^2 + im \cdot im}\right)}{\color{blue}{1 \cdot \log 10}}\]
      9.6
    5. Applied pow1/2 to get
      \[\frac{\log \color{red}{\left(\sqrt{{re}^2 + im \cdot im}\right)}}{1 \cdot \log 10} \leadsto \frac{\log \color{blue}{\left({\left({re}^2 + im \cdot im\right)}^{\frac{1}{2}}\right)}}{1 \cdot \log 10}\]
      9.6
    6. Applied log-pow to get
      \[\frac{\color{red}{\log \left({\left({re}^2 + im \cdot im\right)}^{\frac{1}{2}}\right)}}{1 \cdot \log 10} \leadsto \frac{\color{blue}{\frac{1}{2} \cdot \log \left({re}^2 + im \cdot im\right)}}{1 \cdot \log 10}\]
      9.7
    7. Applied times-frac to get
      \[\color{red}{\frac{\frac{1}{2} \cdot \log \left({re}^2 + im \cdot im\right)}{1 \cdot \log 10}} \leadsto \color{blue}{\frac{\frac{1}{2}}{1} \cdot \frac{\log \left({re}^2 + im \cdot im\right)}{\log 10}}\]
      9.7

    if 1.1667896f+15 < re

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