def format_float_with_sig_figs(value: float, sig_figs: int = 3, trim_zeroes=False) -> str:
    """
    Format a float to a string with a specific number of significant figures.
    Doesn't use scientific notation.
    """
    if value == 0:
        return "0"

    precision = math.ceil(-math.log10(abs(value))) + sig_figs - 1
    if precision < 0:
        precision = 0
    result = "{:.{precision}f}".format(value, precision=precision)

    if trim_zeroes and "." in result:
        result = result.rstrip("0").rstrip(".")

    return result

    Format a float to a string with a specific number of significant figures.
    Doesn't use scientific notation.
    
pyinstrument/util.py