reusable isnan that also checks the nan_set

a better form of the isnan? use of nan_set is debatable, I guess. this is at least reusable.