Talk:Doomsday rule: Difference between revisions

From Rosetta Code
Content added Content deleted
(I think the leap year calculation in the only example has a bug)
 
(ISO 8601 / sunday is 7)
Line 12: Line 12:


--[[User:Not a robot|Not a robot]] ([[User talk:Not a robot|talk]]) 11:40, 1 June 2021 (UTC)
--[[User:Not a robot|Not a robot]] ([[User talk:Not a robot|talk]]) 11:40, 1 June 2021 (UTC)

== Sunday is 7 not 0 ==
At least accordin to ISO 8601, not that programmers would forego a zero-based index just to conform to a petty standard... :-) --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 18:17, 1 June 2021 (UTC)

Revision as of 18:17, 1 June 2021

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)

Sunday is 7 not 0

At least accordin to ISO 8601, not that programmers would forego a zero-based index just to conform to a petty standard... :-) --Pete Lomax (talk) 18:17, 1 June 2021 (UTC)