Implement our own isnan() if necessary

Even if we don't have C99 isnan() we ought to be able to rely on IEEE
isnan.