check if a number is nan code example Example 1: python test is nan math.isnan(n) Example 2: check if value is NaN Number.isNaN(123)