\[\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: 3.8 s
Input Error: 31.5
Output Error: 0.6
Log:
Profile: 🕒
\(\frac{\log \left((e^{\log_* (1 + \sqrt{im^2 + re^2}^*)} - 1)^*\right)}{\log 10}\)
  1. Started with
    \[\frac{\log \left(\sqrt{re \cdot re + im \cdot im}\right)}{\log 10}\]
    31.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{im^2 + re^2}^*\right)}{\log 10}}\]
    0.6
  3. Using strategy rm
    0.6
  4. Applied expm1-log1p-u to get
    \[\frac{\log \color{red}{\left(\sqrt{im^2 + re^2}^*\right)}}{\log 10} \leadsto \frac{\log \color{blue}{\left((e^{\log_* (1 + \sqrt{im^2 + re^2}^*)} - 1)^*\right)}}{\log 10}\]
    0.6

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