Skip to content
Jason Glazer edited this page Feb 23, 2016 · 5 revisions

Catching a NaN

The Microsoft Visual Studio C++ compiler has a way to stop on a NAN (usually shown as a -1.#IND) no matter where or when it is generated. I would expect other compilers do also. To cause it to stop on NAN the /fp:strict should be used as shown at:

http://stackoverflow.com/questions/4454582/visual-studio-c-2008-2010-break-on-float-nan

I could not get it to work by just putting it into the Visual Studio GUI and instead put it on the

CMAKE_CXX_FLAGS CMAKE_C_FLAGS

variables in CMake.

In addition, I had add the fp_control_state to main.cc:

int
main( int argc, const char * argv[] )
{
	unsigned int fp_control_state = _controlfp( _EM_INEXACT, _MCW_EM );
	ProcessArgs( argc, argv );
	EnergyPlusPgm();
}

This was removed prior to checking in the branch.

Clone this wiki locally