[Users] Prologation=NaN

Roland Haas rhaas at aei.mpg.de
Fri Sep 18 01:27:33 CDT 2015

Hello all,

> Don't use NaN for poison!  If you do, then you cannot tell the
> difference between NaNs generated because of numerical problems, and
> poison generated due to programming bugs.
Not true really. There are multiple "nan" values. See eg
http://en.cppreference.com/w/c/numeric/math/nan and if you use nan("17")
for poison you will be able to tell it apart from the nan that you get
out of 1./0 and sqrt(-1.) type errors.

Attached it is a simple C99 program to demonstrate this. Basically it
means that to detect poison you need to use memcmp (which we already do)
and that in floating point arithmetic a nan("17") propagates as a
nan("17") when combined with other non-NaN numbers but may be wiped when
combined with a NaN (which would also wipe a non-NaN poison value though).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: nan.c
Type: text/x-csrc
Size: 1266 bytes
Desc: not available
Url : http://lists.einsteintoolkit.org/pipermail/users/attachments/20150918/e1b2c4ff/attachment.bin 

More information about the Users mailing list