def to_jd(year, month, day):
legal_date(year, month, day)<EOL>if month <= <NUM_LIT:2>:<EOL><INDENT>year -= <NUM_LIT:1><EOL>month += <NUM_LIT:12><EOL><DEDENT>return (trunc((<NUM_LIT> * (year + <NUM_LIT>))) + trunc((<NUM_LIT> * (month + <NUM_LIT:1>))) + day) - <NUM_LIT><EOL>
Convert to Julian day using astronomical years (0 = 1 BC, -1 = 2 BC)