def next_up(x):
    if math.isnan(x) or math.isinf(x) and x > 0:
        return x
if x == 0.0:
    x = 0.0
n = struct.unpack('<q', struct.pack('<d', x))[0]
if n >= 0:
    n += 1
else:
    n -= 1
return struct.unpack('<d', struct.pack('<q', n))[0]
How do you get the next value in the floating-point sequence?