import calendar


def get_yearfrac(d):
    """
    Converts date into floating point value for numerical comparison.

    Treats the year as an integer and calculates the day of the year divided by
    the total number of days in the respective year to add as a fractional
    component.

    Parameters
    ----------
    d : date
        Date to be converted into floating point value.

    Returns
    -------
    float
        Formatted version of error with type and message.

    """
    return d.year + (d.timetuple().tm_yday + 0.0) \
           / (366 if calendar.isleap(d.year) else 365)