handle NaNs in float conversion