闰年计算 [英] Leap year calculation
问题描述
为了找到闰年,为什么年份必须不能被 100 整除,而且必须能被 400 整除?
In order to find leap years, why must the year be indivisible by 100 and divisible by 400?
我明白为什么它必须被 4 整除.请解释算法.
I understand why it must be divisible by 4. Please explain the algorithm.
推荐答案
一年的长度是(或多或少)365.242196 天.因此,我们必须或多或少地减去四分之一天以使其适合:
The length of a year is (more or less) 365.242196 days. So we have to subtract, more or less, a quarter of a day to make it fit :
365.242196 - 0.25 = 364.992196(4 年增加 1 天):但是哎呀,现在太小了!!让我们添加一百天(通过在一百年内不添加一天:-))
365.242196 - 0.25 = 364.992196 (by adding 1 day in 4 years) : but oops, now it's too small!! lets add a hundreth of a day (by not adding that day once in a hundred year :-))
364.992196 + 0,01 = 365.002196(哎呀,有点太大了,无论如何让我们在大约 400 年后添加一天)
364.992196 + 0,01 = 365.002196 (oops, a bit too big, let's add that day anyway one time in about 400 years)
365.002196 - 1/400 = 364.999696
365.002196 - 1/400 = 364.999696
现在差不多了,只需时不时地玩一下闰秒,就可以了.
Almost there now, just play with leapseconds now and then, and you're set.
(注意:在这一步之后不再应用更正的原因是因为一年的长度也在变化!!这就是为什么闰秒是最灵活的解决方案,例如参见 这里)
(Note : the reason no more corrections are applied after this step is because a year also CHANGES IN LENGTH!!, that's why leapseconds are the most flexible solution, see for examlple here)
这就是我猜的原因
这篇关于闰年计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!