[petsc-dev] NaN constant?

Jed Brown jed at jedbrown.org
Wed Oct 28 11:29:16 CDT 2015


Barry Smith <bsmith at mcs.anl.gov> writes:

>   I don't want to be in the business of providing NaNs. They are nasty little beasts. PETSc should allow users to use NaN but should not enable them.

FP non-normal values are also extremely slow on some architectures so
it's a bad portability move to use them to identify missing values.  (Or
maybe future hardware will embrace in-band missing values and make sure
NaN is fast.)  In any case, signaling NaN is extremely useful for
debugging.

>> Fortunately, we've had C99 for 16 years.
>> 
>> #include <math.h>
>> 
>>  NAN
>
>   Way to name space?

Yeah, it should be M_NAN.  It'd be interesting to hear the rationale for
plain NAN; I would assume some vendor started using it and a bunch of
others adopted it, so the standard was just acknowledging the status
quo.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20151028/228ffd04/attachment.sig>


More information about the petsc-dev mailing list