def jd2gdate(myjd):
    """Julian date to Gregorian calendar date and time of day.

    The input and output are for the proleptic Gregorian calendar.

    Parameters
    ----------
   myjd:
        julian date (float).

    Returns
    -------
    y, m, d, f : int, int, int, float
        Four element tuple containing year, month, day and the
        fractional part of the day in the Gregorian calendar. The first
        three are integers, and the last part is a float.

    """

    jd_i = int(myjd)

    f = myjd-jd_i

    # Set JD to noon of the current date. Fractional part is the
    # fraction from midnight of the current date.
    if -0.5 < f < 0.5:
        f += 0.5
    elif f >= 0.5:
        jd_i += 1
        f -= 0.5
    elif f <= -0.5:
        jd_i -= 1
        f += 1.5

    l = jd_i + 68569
    n = int((4 * l) / 146097.0)
    l -= int(((146097 * n) + 3) / 4.0)
    i = int((4000 * (l + 1)) / 1461001)
    l -= int((1461 * i) / 4.0) - 31
    j = int((80 * l) / 2447.0)
    day = l - int((2447 * j) / 80.0)
    l = int(j / 11.0)
    month = j + 2 - (12 * l)
    year = 100 * (n - 49) + i + l

    return int(year), int(month), int(day), f