\[\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: 5.2 s
Input Error: 15.0
Output Error: 0.3
Log:
Profile: 🕒
\(\log \left(e^{\frac{\log \left(\sqrt{im^2 + re^2}^*\right)}{\log 10}}\right)\)
  1. Started with
    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    15.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{im^2 + re^2}^*\right)}{\log 10}}\]
    0.3
  3. Using strategy rm
    0.3
  4. Applied add-log-exp to get
    \[\color{red}{\frac{\log \left(\sqrt{im^2 + re^2}^*\right)}{\log 10}} \leadsto \color{blue}{\log \left(e^{\frac{\log \left(\sqrt{im^2 + re^2}^*\right)}{\log 10}}\right)}\]
    0.3

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