def recall(tp, fn):
    """
    Computes precision

    Args:
        tp (int): true positive
        fn (int): false negative

    Returns:
        float: precision
    """
    try:
        return float(tp) / (tp + fn)
    except ZeroDivisionError:
        return 0