Prefer std::isnan
over !=
comparison trick
#2977
Merged
std::isnan
over !=
comparison trick
#2977