import struct


def float_to_reg(number):
    """convert Python float to reg value"""
    try:
        st = struct.pack(">f", number)
    except OverflowError:
        if number > 0.0:
            number = float("inf")
        else:
            number = float("-inf")
        st = struct.pack(">f", number)
    return struct.unpack(">L", st)[0]