Checking for NaN

Addresses issue #12 by adding a branch to check for `NaN`. (which returns `"nan"`)