import math


def calc_insert_ratio(insert_count, pileup_count):
    """Given the insert count and pileup count of a position,
    return the insert count ratio."""
    try:
        return insert_count / pileup_count
    except ZeroDivisionError:
        return math.nan