cast: use is_nan to avoid integer warnings

This commit is contained in:
Danny Robson 2017-01-23 21:48:12 +11:00
parent 6f4bc6d6b2
commit d1fe677977

View File

@ -88,10 +88,7 @@ trunc_cast (const SrcT src)
{
auto dst = static_cast<DstT> (src);
// check if we're testing a NaN by using self-equality. this will not hold
// for NaN, but makes specialisation easier given we don't need to special
// case for integers (which don't have std::isnan).
if (src == src) {
if (!util::is_nan (src)) {
CHECK_EQ (static_cast<SrcT> (dst), src);
} else {
CHECK_NEQ (dst, dst);