re \cdot im + im \cdot re
\left(re + re\right) \cdot im
(FPCore im_sqr (re im) :precision binary64 (+ (* re im) (* im re)))
(FPCore im_sqr (re im) :precision binary64 (* (+ re re) im))
double im_sqr(double re, double im) {
return (re * im) + (im * re);
}
double im_sqr(double re, double im) {
return (re + re) * im;
}



Bits error versus re



Bits error versus im
Results
Initial program 0.0
Simplified0.0
Applied *-un-lft-identity_binary640.0
Applied distribute-rgt1-in_binary640.0
Applied associate-*r*_binary640.0
Simplified0.0
Final simplification0.0
herbie shell --seed 2022068
(FPCore im_sqr (re im)
:name "math.square on complex, imaginary part"
:precision binary64
(+ (* re im) (* im re)))