Why D is annoying =P

Rob T rob at ucora.com
Mon Oct 29 12:55:40 PDT 2012


On Monday, 29 October 2012 at 18:39:41 UTC, H. S. Teoh wrote:
> On Mon, Oct 29, 2012 at 06:34:14PM +0100, Rob T wrote:
> [...]
>> There is a problem with floating point memebers, since nan 
>> values will
>> always compare false.
>
> This is IEEE specification. There is no problem.
>
>
> T

If struc comparisions compare value by value, and both have Nan 
values in one member variable, then the two otherwise completely 
identical structs will always compare false even though they are 
identical. I think it would be best to have the ability to 
compare structs in two ways, one as struct equivalence, which 
would be the default method, the other as vale by value 
equivalence, which would have to be programmer defined through 
overload of == operator.

--rt


More information about the Digitalmars-d mailing list