\[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.6 s
Input Error: 0.0
Output Error: 0.0
Log:
Profile: 🕒
\({re}^2 - {im}^2\)
  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. Applied simplify to get
    \[{re}^2 - \color{red}{im \cdot im} \leadsto {re}^2 - \color{blue}{{im}^2}\]
    0.0

  4. Removed slow pow expressions

Original test:


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