www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Complex number comparisons

The special floating point comparisons do not detect the "unordered" 
case when the imaginary components are not NAN, but one or both of the 
real components is NAN.

Also, I have a specification question: Does D define an ordering for 
complex numbers?  If not, should using the other relational operators be 
an error?

int main() {
   cdouble a = double.nan + 3i;
   cdouble b = double.nan + 4i;

   assert( ! (a <> b) );
   assert( ! (a <>= b) );
   assert( a !<>= b );
   assert( a !<> b );

   return 0;
}

David
Jan 01 2005