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

Ali Çehreli acehreli at yahoo.com
Thu Apr 19 00:57:40 PDT 2012


On 04/18/2012 05:50 PM, bearophile wrote:
 > This is an open enhancement request that I'll probably add to Bugzilla.
 > The direct cause of it is a recent discussion in D.learn, but I and
 > other people are aware of this problem for a lot of time.

[...]

 > assert(myNaN == double.nan);
 > }
 >
 >
 >
 > So I propose to statically disallow comparisons of Program #3, so it
 > generates errors similar to:
 >
 > test.d(4): Error: comparison is always false. Use 'std.math.isNaN' to
 > test for every kind of NaN or 'is float.nan' for this specific NaN

+1. This enhancement will be helpful.

Ali



More information about the Digitalmars-d mailing list