Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculate leap year #23

Closed
capitainekurck opened this issue May 3, 2023 · 3 comments
Closed

Calculate leap year #23

capitainekurck opened this issue May 3, 2023 · 3 comments
Assignees

Comments

@capitainekurck
Copy link

Hello,

I m not a C guru but it seem that to find a leap year you divide the year by 4. you must also consider dividing by 100 and 400.
There is an explanation here:
https://learn.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year
or here but it mid french mid english
https://fr.wikihow.com/calculer-les-ann%C3%A9es-bissextiles
regard

@SV-Zanshin
Copy link
Collaborator

That is correct, the original formula was incomplete, it has now been fixed to read

if (m > 2 && (((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)))

@SV-Zanshin
Copy link
Collaborator

Change implemented in source

SV-Zanshin added a commit that referenced this issue May 3, 2023
@SV-Zanshin
Copy link
Collaborator

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants