double.init is nan ..?

Etienne etcimon at gmail.com
Fri Mar 14 10:17:18 PDT 2014


On 2014-03-14 1:01 PM, Adam D. Ruppe wrote:
> On Friday, 14 March 2014 at 16:50:11 UTC, bearophile wrote:
>> Keep in mind that there are many NaNs, and double.nan is not the same
>> as dounle init.
>
> Oh yeah, I forgot about that! (double.init is a signaling nan while
> double.nan is not. There's a whole bunch of other nans possible in
> floating point too btw)
>
> You're right. Looks like "is" always just compares the raw bits, which
> is good stuff when comparing with init.
>
>> So this passes:
>>
>> assert(test is double.init);

OK so I don't have to pack the structs to compare them! Thanks :)


More information about the Digitalmars-d mailing list