I was looking at Omid K. Rad's implementation of calendar, and have a few comments on calculating leap years.
1. The implemented algorithm uses a 128 year period, although the comments say it uses a 2820 year period. While I need to ask for this discrepancy be resolved, it is important to understand that the 128 year period and the 2820 year period only differ once every 2820 years. In other words, the current implementation does not differ from the 2820 year method until year 3294 A.P (or H.S.). 2. However, it seems to me that the 2820 Birashk method -- the one with 21 128 year period and one 132 year period -- will start showing discrepancies with the observed norouz as early as 1788 A.P. The reason, is that the Birashk method tries to be in sync with the 128 year method as much as possible, and adjust the extra leap year at the end of 2820 years. However, the earth does not care about this assumption, and will rotate around the sun constantly (see caveat below), unless Birashk has considered the variation of length of years The correct 2820 year formula will then be: (based on the assumption that there are 683 evenly spread leap years in 2820 years, and also aligning the leap years with the largest extent of years around today) Here, variable year refers to year in A.P or H.S. Ordak's 2820 year method: bool isLeap2820ODC = ((683*year+542) % 2820) < 683; in comparison to: Birashk's 2820 year method: bool isLeap2820Birashk = ((year % 2820) == 474) || (((31 * ((year+2345) % 2820)) % 128) > 96); The discrepancies will be in: years that Ordak considers leap but not Birashk 603, 731, 859, 1787, 1915, 2043, 2171, 2299, 2427, 2460, 2555, 2588, 2683, 2716, 2811, 2844, 2939, 2972, 3067, 3100, 3133, 3195, 3228, 3261, 3295 and years that Birashk considers leap but not Ordak 602, 730, 858, 1788, 1916, 2044, 2172, 2300, 2428, 2461, 2556, 2589, 2684, 2717, 2812, 2845, 2940, 2973, 3068, 3101, 3134, 3196, 3229, 3262, 3294 Caveat: According to: http://scienceworld.wolfram.com/astronomy/TropicalYear.html The length of year is decreasing each year. According to graphs in http://www.angelfire.com/dc2/calendrics/ The real length of vernal equinox year (Iranian year) is increasing each year (from 351 BC to 3175 A.D.) According to Iranian tradition, vernal equinox should happen before noon (I think it means astronomical noon). So, there is not much we can do with simple algorithms other than trying to approximate the real world, and understanding the fact that ALL calendar algorithms are only APPROXIMATIONS. -- ODC _______________________________________________ PersianComputing mailing list [EMAIL PROTECTED] http://lists.sharif.edu/mailman/listinfo/persiancomputing