Support for NaN, Infinity, and -Infinity.

Tried to follow coding style.
Tests included (all pass).