Refs #8958 checks and outputs nan and inf consistently

Nan and inf values are checked for and output in a constant format. (hopefully across platforms)