Carpet default poison value should not be NaN

Issue #1583 new
Ian Hinder created an issue

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)

  1. Erik Schnetter
    • removed 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.

  2. Ian Hinder 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).

  3. Roland Haas
    • 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.

  4. Log in to comment