def _isnan(num):
 num = str(num).lower()
 if (not num):
  return 0
 sign = 0
 if (num[0] == '+'):
  num = num[1:]
 elif (num[0] == '-'):
  num = num[1:]
  sign = 1
 if num.startswith('nan'):
  if ((len(num) > 3) and (not num[3:].isdigit())):
   return 0
  return (1, sign, num[3:].lstrip('0'))
 if num.startswith('snan'):
  if ((len(num) > 4) and (not num[4:].isdigit())):
   return 0
  return (2, sign, num[4:].lstrip('0'))
 return 0

def _isnan ( num ) : num = str ( num ) . lower ( ) if ( not num ) : return 0 sign = 0 if ( num [ 0 ] == '+' ) : num = num [ 1 : ] elif ( num [ 0 ] == '-' ) : num = num [ 1 : ] sign = 1 if num . startswith ( 'nan' ) : if ( ( len ( num ) > 3 ) and ( not num [ 3 : ] . isdigit ( ) ) ) : return 0 return ( 1 , sign , num [ 3 : ] . lstrip ( '0' ) ) if num . startswith ( 'snan' ) : if ( ( len ( num ) > 4 ) and ( not num [ 4 : ] . isdigit ( ) ) ) : return 0 return ( 2 , sign , num [ 4 : ] . lstrip ( '0' ) ) return 0
determines whether a string or float is nan => nan => snan 0 => not a nan .