Talk:Doomsday rule

From Rosetta Code
Revision as of 11:40, 1 June 2021 by Not a robot (talk | contribs) (I think the leap year calculation in the only example has a bug)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

January 6, 1800

The Julia example (supplied by the task writer) claims January 6, 1800 was a Sunday. However, I am pretty sure it was a Monday (that's what I get when I try to implement it, and both Linux cal and WolframAlpha also agree with me).

I think the leap year determination is wrong in the Julia example. It says: <lang julia>(year % 4 != 0) || (r == 0 && year % 400 == 0) ? # leap year determination</lang> where r is the year modulo 100.

I don't know Julia but it seems that this checks whether the year is divisible by 4, and if not, by both 100 and 400. It should be (divisible by 4 and ((not divisible by 100) or divisible by 400)). Surely this should instead be: <lang julia>(year % 4 != 0) || (r == 0 && year % 400 != 0)</lang>

--Not a robot (talk) 11:40, 1 June 2021 (UTC)