- removed comment
Carpet default poison value should not be NaN
Carpet initialises Cactus variables to NaN as this is a quantity which is likely to be noticed. However, this makes it impossible to know when you see a NaN whether you have a programming error (accessing uninitialised memory) or a numerical problem (numerical solution has blown up).
I usually set the carpet poison value to something else; a value like 10^230 is just as likely to be noticed as a NaN, and when you see exactly that value, you know that you are looking at uninitialised data, rather than a computation which went wrong.
Keyword:
Comments (4)
-
-
reporter - removed comment
I think we need a solution which works with ASCII output, as well as values displayed on standard output. If we must use NaN, maybe Cactus could interpret it and call it POISON every time it outputs it as ASCII (to file or standard output/error).
-
- removed comment
We could add the nan pattern to ASCII output, e.g. as "nan(0x12345678)".
-
- removed comment
Side note: it would be good if CarpetLib were to also poison new memory by default, the same way that Carpet poisons new timelevels by default.
- Log in to comment
There are many different nan values. When you see a nan, you can check whether it has this value. Unfortunately, ASCII output does not output the nan bit pattern on most systems.