These are working JavaScript functions a part of a larger program.

Could someone translate these into mathematical formulas non-Javascript.

I am not sure what these two expressions mean:

1) ((year % 4) == 0) && (!(((year % 100) == 0) && ((year % 400) != 0)))
2) ((month <= 2) ? 0 : (leap_gregorian(year) ? -1 : -2)


Code:
function leap_gregorian(year)
{
    return ((year % 4) == 0) && (!(((year % 100) == 0) && ((year % 400) != 0)));
}
function gregorian_to_jd(year, month, day)
{
    return (1721425.5 - 1) +
           (365 * (year - 1)) +
           Math.floor((year - 1) / 4) +
           (-Math.floor((year - 1) / 100)) +
           Math.floor((year - 1) / 400) +
           Math.floor((((367 * month) - 362) / 12) +
           ((month <= 2) ? 0 : (leap_gregorian(year) ? -1 : -2)
           ) +
           day);
}