Lots of bool operations shouldn't compile

Don Clugston dac at nospam.com.au
Thu Mar 2 01:14:04 PST 2006


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Don Clugston schrieb am 2006-02-28:
> 
> [snip]
> 
>> OK, there's another bug in there, comparing an int with an imaginary 
>> real should also not be legal.
>>
>>      if (1 > -2i) { assert(0); }
>>      if (1 > ireal.nan) { assert(0); }
>>
>> Reals and ireals cannot be compared. Ever.
> 
> Sure you can. Floats and imaginary floats can both be implicitly promoted
> to complex floats.

That only gives you == and !=.

<snip>
> Thus
> 
>>      if (1 > -2i) { assert(0); }
>>      if (1 > ireal.nan) { assert(0); }
> 
> are interpreted as
> 
>>      if (1 + 0i > 0 - 2i) { ... }
>>      if (1 + 0i > 0 + ireal.nan) { ... }

Yes, but that still doesn't work, there's no > for complex numbers.
Is  2 - 3i > 3 - 2i ?



More information about the Digitalmars-d-bugs mailing list