Am 28.04.2013 19:10, schrieb Sami Kerola: > -/* leap year -- account for gregorian reformation in 1752 */ > -#define leap_year(yr) \ > - ((yr) <= 1752 ? !((yr) % 4) : \ > - (!((yr) % 4) && ((yr) % 100)) || !((yr) % 400)) > [...] > +/* leap year -- account for gregorian reformation in 1752 */ > +int leap_year(int year) > +{ > + if (year <= 1752) > + return !(year % 4); > + else > + return !(year % 4 && (year % 100 || year % 400)); > +} This formula is incorrect, there's a difference between the old version and yours. The original (correct) version is: ( !(year % 4) && (year % 100) ) || !(year % 400)
Attachment:
signature.asc
Description: OpenPGP digital signature