Calendar Functions (simpler leap year calculation)

Daniel R. Levy levy at ttrdc.UUCP
Wed Sep 17 09:38:21 AEST 1986


In article <886 at ihdev.UUCP>, pdg at ihdev.UUCP (P. D. Guthrie) writes:
>>Or if you want a simple cpp macro:
>>
>>#define  isleapyear(year)   ((year)%4)
>>
>>Bob Devine
>
>Or if you want a complex cpp macro
>to return the number of days in a year......
>
>#define num_day(x) ((x)%4 ? (x)%100 ? (x)%400 ? 366 : 355 : 356 : 355)
                                                       ^^^   ^^^   ^^^

Huh?
-- 
 -------------------------------    Disclaimer:  The views contained herein are
|       dan levy | yvel nad      |  my own and are not at all those of my em-
|         an engihacker @        |  ployer or the administrator of any computer
| at&t computer systems division |  upon which I may hack.
|        skokie, illinois        |
 --------------------------------   Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa,
	   go for it!  			allegra,ulysses,vax135}!ttrdc!levy



More information about the Comp.lang.c mailing list