problem with isnan

pineapple via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 11 10:31:17 PST 2016


On Thursday, 10 November 2016 at 16:47:30 UTC, Adam D. Ruppe 
wrote:
> On Thursday, 10 November 2016 at 16:41:56 UTC, Charles Hixson 
> wrote:
>> It's *supposed* to be nan, and the assert message reports that 
>> it is, but it should pass the assert test, not throw an 
>> assertion.  What am I doing wrong?
>
> How did you set it? There are like billions of different NaNs. 
> I'm not sure if isnan checks for all of them. (I'm also not 
> sure that it doesn't, the docs don't specify.)
>
> you might try using std.math.isNaN instead and see what it does.

Incidentally, I just recently submitted a PR to fix this.

What probably happened is that you're referring to a limited 
`isnan` method defined as a unittest utility method in object.d 
that should have been private but wasn't.

You want to use `isNan` instead.



More information about the Digitalmars-d-learn mailing list