Disallow (dis)equality with FP.nan/FP.init literals

Maxim maxim at maxim-fomin.ru
Thu Apr 19 01:31:35 PDT 2012


On Thursday, 19 April 2012 at 01:28:51 UTC, so wrote:
> Good idea.
> But nothing beats this:
>
> int main() {
>     double  q;
>     q = 3.0/7.0;
>     if (q == 3.0/7.0) printf("Equal\n");
>     else printf("Not Equal\n");
>     return 0;
> }
>
> http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
> Should we disable implicit conversion "at" comparison as well?

Gcc has warning option for comparing floats or doubles. I think 
it would be good idea to introduce warnings (or errors) in dmd 
too.


More information about the Digitalmars-d mailing list