闰年的计算 [英] leap year calculation

查看:160
本文介绍了闰年的计算的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了找到闰年,为什么一定要在今年由400 100不可分割的,可分? 我明白为什么它必须要能被4整除请解释的算法。

In order to find leap years, why must the year be indivisible by 100 and divisible by 400? 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年51天):但哎呀,现在是太小了!让我们来添加一天的hundreth(通过不补充说,每天一次在百年的: - ))

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

快到了,现在,只需用leapseconds起到现在,然后,和你设置。

Almost there now, just play with leapseconds now and then, and you're set.

(注意:不改正的这一步后应用的原因,是因为一年也改变长!,这就是为什么leapseconds是最灵活的解决方案,请参阅examlple的here

(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆