added isfinite checks in C code.  Added divzero check in stats code