Add the following header file:
#include <float.h>
then in your main program insert the following at the top:
unsigned ctrl = _controlfp(0,0);
ctrl &= ~EM_ZERODIVIDE;
_controlfp(ctrl, _MCW_EM);