\[re \cdot re - im \cdot im\]
Test:
math.square on complex, real part
Bits:
128 bits
Bits error versus re
Bits error versus im
Time: 3.3 s
Input Error: 0.0
Output Error: 0
Log:
Profile: 🕒
\(\left(\left|im\right| + re\right) \cdot \left(re - \left|im\right|\right)\)
  1. Started with
    \[re \cdot re - im \cdot im\]
    0.0
  2. Applied simplify to get
    \[\color{red}{re \cdot re - im \cdot im} \leadsto \color{blue}{{re}^2 - im \cdot im}\]
    0.0
  3. Using strategy rm
    0.0
  4. Applied add-sqr-sqrt to get
    \[{re}^2 - \color{red}{im \cdot im} \leadsto {re}^2 - \color{blue}{{\left(\sqrt{im \cdot im}\right)}^2}\]
    0.0
  5. Applied difference-of-squares to get
    \[\color{red}{{re}^2 - {\left(\sqrt{im \cdot im}\right)}^2} \leadsto \color{blue}{\left(re + \sqrt{im \cdot im}\right) \cdot \left(re - \sqrt{im \cdot im}\right)}\]
    0.0
  6. Applied simplify to get
    \[\color{red}{\left(re + \sqrt{im \cdot im}\right)} \cdot \left(re - \sqrt{im \cdot im}\right) \leadsto \color{blue}{\left(\left|im\right| + re\right)} \cdot \left(re - \sqrt{im \cdot im}\right)\]
    0.0
  7. Applied simplify to get
    \[\left(\left|im\right| + re\right) \cdot \color{red}{\left(re - \sqrt{im \cdot im}\right)} \leadsto \left(\left|im\right| + re\right) \cdot \color{blue}{\left(re - \left|im\right|\right)}\]
    0

Original test:


(lambda ((re default) (im default))
  #:name "math.square on complex, real part"
  (- (* re re) (* im im)))