I've got a controls problem which due to extreme stiffness in normal coordinates can lead to nan showing up. The problem with nan is that it's contagious, and will eventually spread like a virus through all the calculations.
Of course, I can check at every iteration if nan is in the output, or, better, I can check the parts of the code that can possibly give a nan and squash it there. However, this is a giant waste of resources for something that can potentially occur, but will not in the vast majority of cases.
The best (from a computational efficiency) solution would simply be to "disable" nan. I realize that theoretically this could do some funny things, but in my case it can't. I know this is a long shot, but I think the problem is interesting so it's worth a try. Is there any compiler way to redefine nan to something else?
Turns out that there is no GCC command to deactivate Nan, but Clawson showed how to change and recompile GCC in order to have this effect: https://www.avrfreaks.net/index.p...