Fix stan::math::exp behaviour for NaN (for matrices of doubles)

#### Summary and Intended Effect:

Fix nan behaviour for stan::math::exp for matrices of double.

#### How to Verify:

The code is simple, and it should pass existing tests for non-nan values and future tests for NaN values.

#### Side Effects:

None.

#### Documentation:

Not applicable.

#### Reviewer Suggestions:

Anyone.