Talk:Doomsday rule
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)
This is correct, and comes from mixing up == and !=. Fixed.
-- --Wherrera (talk) 19:04, 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)
- I rather suspect that being 7 mod 7 is 0, not 7, most programmers would rather use consistent operators and indexing and avoid adding unnecessary complexity rather than mindless conformance to some external standards format that has little to do with how such indexes are calculated... but that's just me. --Thundergnat (talk) 18:50, 1 June 2021 (UTC)
Conway actually made up mneumonic names for the days of the week to fix his scheme, and these are NOT the ISO standard (see Wiki entry).