def format_val(val: float) -> str:
    """Format float and return as str. Rules are round to two decimal places,
    then remove any trailing 0s and decimal point if necessary.

    Args:
        val (float): Number to format.

    Returns:
        str: Number rounded to two decimal places with trailing '0' and '.'
        removed.
    """
    return f'{val:.4f}'.rstrip('0').rstrip('.')