[petsc-dev] NaN constant?
Václav Hapla
vaclav.hapla at vsb.cz
Wed Oct 28 15:55:13 CDT 2015
Dne 28.10.2015 v 20:31 Lisandro Dalcin napsal(a):
> On 28 October 2015 at 19:29, Jed Brown <jed at jedbrown.org> wrote:
>> 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.
>>
> I would also like to have PETSC_SNAN define for signaling NaN.
Thumbs up!
It is for me in some cases also the only or at least the least
error-prone way to signalize e.g. value that needs to be set somewhere
else, or value that is invalid, or invalidated value that needs to be
recomputed etc etc.
In case of objects you have NULL but in case of numbers when you need
all negative, 0 and positive values as valid, it's a problem. You need
e.g. an extra PetscBool flag which can be tedious. Additionally, NaN
value typically spoils the things quickly just like a NULL object so
that a bug can be caught early.
Vaclav
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3290 bytes
Desc: Elektronicky podpis S/MIME
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20151028/a867cc03/attachment.p7s>
More information about the petsc-dev
mailing list