def from_jd(jd):
try:<EOL><INDENT>assert jd >= EPOCH<EOL><DEDENT>except AssertionError:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>depoch = floor(jd - <NUM_LIT:0.5>) + <NUM_LIT:0.5> - gregorian.EPOCH<EOL>quadricent = floor(depoch / gregorian.INTERCALATION_CYCLE_DAYS)<EOL>dqc = depoch % gregorian.INTERCALATION_CYCLE_DAYS<EOL>cent = floor(dqc / gregorian.LEAP_SUPPRESSION_DAYS)<EOL>dcent = dqc % gregorian.LEAP_SUPPRESSION_DAYS<EOL>quad = floor(dcent / gregorian.LEAP_CYCLE_DAYS)<EOL>dquad = dcent % gregorian.LEAP_CYCLE_DAYS<EOL>yindex = floor(dquad / gregorian.YEAR_DAYS)<EOL>year = (<EOL>quadricent * gregorian.INTERCALATION_CYCLE_YEARS +<EOL>cent * gregorian.LEAP_SUPPRESSION_YEARS +<EOL>quad * gregorian.LEAP_CYCLE_YEARS + yindex<EOL>)<EOL>if yindex == <NUM_LIT:4>:<EOL><INDENT>yearday = <NUM_LIT><EOL>year = year - <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>yearday = (<EOL>depoch -<EOL>quadricent * gregorian.INTERCALATION_CYCLE_DAYS -<EOL>cent * gregorian.LEAP_SUPPRESSION_DAYS -<EOL>quad * gregorian.LEAP_CYCLE_DAYS -<EOL>yindex * gregorian.YEAR_DAYS<EOL>)<EOL><DEDENT>month = floor(yearday / <NUM_LIT>)<EOL>return (year - YEAR_EPOCH + <NUM_LIT:2>, month + <NUM_LIT:1>, int(yearday - (month * <NUM_LIT>)) + <NUM_LIT:1>)<EOL>
Convert a Julian day count to Positivist date.