def floatToHumanReadable(f, binary=False):
    """Convert a float to a human readable string.
	"""
    f = float(f)
    fAbs = abs(f)
    if binary:
        divs = (1024.0 ** 3, 'Gi'), (1024.0 ** 2, 'Mi'), (1024.0 ** 1, 'Ki')
    else:
        divs = (1000.0 ** 3, 'G'), (1000.0 ** 2, 'M'), (1000.0 ** 1, 'k')
    for div, pfx in divs:
        if fAbs >= div:
            fStr = '%.02f %s' % (f / div, pfx)
            break
    else:
        fStr = '%.02f' % f
    return fStr
