Ref #14313: NaN detection. Close gh-1352.