fix the "only <double> can be queried for NaN" exceptions

seems like some compilers don't overwrite an inline method of a
template class with its specialization. A compiler warning would have
been nice to have in this case, though...
Merge pull request #332 from andlaus/fix_nan_exception

fix the "only <double> can be queried for NaN" exceptions