An alternative system that is conceptually simpler, very elegant in binary and very accurate is the following:

  • Each year is not a leap year...
  • ...unless it is divisible by 4, in which case it is...
  • ...unless it is divisible by 128, in which case it is not.

This has the advantage of being faster to evaluate on a binary computer, and only involves two tests rather than the current three. The disadvantage is that no-one uses it, so if you do, you'll be wrong, and it's harder to do mental division by 128 in decimal than by 400. Non-optimal C implementation below.

int is_alt_leap (int year) {
   int leap = 0;
   if ((year & 0x03) == 0) {
      leap = 1;
      if ((year & 0x7F) == 0)
         leap = 0;
   }
   return leap;
}