appending newly initialized struct to array

Ali Çehreli acehreli at yahoo.com
Wed Apr 18 06:41:15 PDT 2012


On 04/18/2012 12:16 AM, Kenji Hara wrote:
> On Wednesday, 18 April 2012 at 04:55:23 UTC, Ali Çehreli wrote:

>> assert(s.d == double.nan); // <-- fails (may work for you)
>
> You should use std.math.isNaN whether a floating point value is NaN.
>
> assert(isNaN(s.d)); // <-- success

That a thousandth time I have made that mistake and still have not 
learned. :( Yes, .nan may not be compared with any other value, 
including .nan.

Ali


More information about the Digitalmars-d-learn mailing list