def float_to_bin(x, m_digits:int):
    """ 
    Convert a number x in range [0,1] to a binary string truncated to length m_digits

    arguments:
        x: float 
        m_digits: integer
    
    return: 
        x_bin: string
        The decimal representation of digits AFTER '0.'
        Ex:
            Input 0.75 has binary representation 0.11 
            Then this function would return '11'
    """
    if x < 0 or x >= 1:
        raise ValueError("x must be in interval [0,1)")
    x_round = round(x * 2**m_digits)
    # print(x_round)
    # print(2**m_digits)
    if x_round == 2**m_digits:
        x_round = 0
    x_raw = bin(x_round)
    x_bin = x_raw[2:].zfill(m_digits)
    return x_bin