Feature/issue 843 test nan

#### Summary:

Adds tests for NaN input for all math functions. This pull request **does not** change behavior of the code. These are all tests that document behavior under NaN input.

#### Intended Effect:

All math functions are tested with NaN. The functions that have changes have been dealt with through different pull requests.

#### How to Verify:

Run the tests.

#### Side Effects:

None.

#### Documentation:

If anything, we should add C++ api doc. The code never lies, though. 

#### Reviewer Suggestions:

Anyone.