Re: [PATCH 02/11] cal: convert function like definitions to functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux