def fp_to_float(n_frac):
    """Return a function to convert a fixed point value to a floating point
    value.

    For example, a function to convert from signed fractional representations
    with 4 fractional bits constructed and used with::

        >>> f = fp_to_float(4)
        >>> f(0x08)
        0.5

        >>> f(-0x8)
        -0.5

        >>> f(-0x78)
        -7.5

    Parameters
    ----------
    n_frac : int
        Number of fractional bits in the fixed-point representation.
    """
    scale = 2.0**(-n_frac)

    def kbits(value):
        """Convert a fixed point value to a float.

        Parameters
        ----------
        value : int
            The fix point value as an integer.
        """
        return value * scale

    return kbits