[Pdl-porters] Puzzled by BADVAL_USENAN set to 1

Sisyphus sisyphus1 at optusnet.com.au
Thu Apr 12 13:45:40 HST 2012

----- Original Message ----- 
From: "David Mertens"

> Oh, yes, your absolutely correct. pdl-from-string only turns on the bad
> flag when it sees the string 'bad': that 'nan' should turn on the badflag
> never occurred to me, but clearly it should.

Would this mean that 'pdl q[nan]' would return '[BAD]' (instead of '[nan]' 
as it currently does) ?

If so, there will be other tests in pdl_from_string.t that need to be 
skipped - such as tests 37 and 38.

> I think that inf is considered to be a number and should not be marked as
> bad when nan is bad, but if we have a previous behavior, I can change my
> implementation in favor of consistency.

It seems to be the current behaviour - and the reason that tests 30 and 31 
need to be skipped.

It also fits in better with Doug's original intentions. Earlier in this 
thread he has said:

 So I think (I don't have the time to go code diving) that
when I used NAN in the documentation I really should have said "whatever
the term is for bit patterns which are commonly referred to as Nan/Inf
and there negative versions".

And, of course, if 'pdl q[inf]' starts returning '[BAD]', then there will be 
even more tests to skip in pdl_from_string.t


More information about the PDL-porters mailing list