is equal with realpart



To save possible time I want to use a test like
----------
if is (equal (bex, realpart(bex))) then do something
-----------
This saves time (and up to now works) so that I
don't have to take into account that I need to deal
separately with the real and imaginary parts of bex.

But now I have a case where it doesn't work:
(5.26.0 gcl )
--------------------------
(%i1) display2d:false$

(%i2) bex : 1/sqrt(sin(x));
(%o2) 1/sqrt(sin(x))

(%i3) realpart(bex);
(%o3) cos(atan2(0,sin(x))/2)/sqrt(abs(sin(x)))

(%i4) imagpart(bex);
(%o4) -sin(atan2(0,sin(x))/2)/sqrt(abs(sin(x)))

(%i5) is (equal (bex, realpart(bex)));
(%o5) true            <==  wrong!

(%i6) is (equal (bex, imagpart(bex)));
(%o6) false          <== correct
---------------------------------
Is there a better test I can use?

Ted Woollett