def calc_precision(tp: int, fp: int) -> float:
    """Calculate Precision.

    Args:
        tp (int): amount of TP.
        fp (int): amount of FP.

    Returns:
        float: precision for the given amounts of TP and FP.
    """

    if tp + fp != 0:
        precision = float(tp / (tp + fp))

    else:
        # prevent zero division error.
        precision = 0

    return precision