def to_ulps(x):
 n = struct.unpack('<q', struct.pack('<d', x))[0]
 if (n < 0):
  n = (~ (n + (2 ** 63)))
 return n

def to_ulps ( x ) : n = struct . unpack ( '<q' , struct . pack ( '<d' , x ) ) [ 0 ] if ( n < 0 ) : n = ( ~ ( n + ( 2 ** 63 ) ) ) return n
convert a non-nan float x to an integer .