470,644 Members | 1,202 Online

# Calendar fun

The Julian Calendar, adopted in 46BC by Julius Caesar, adds one day every
four years to correct for the fact that Earth's solar year is slightly more
than 365 of Earth's daily rotations. ( 365.25 days per year)

The Gregorian Calendar, adopted in 1582 by Pope Gregory XIII, ordered that
leap years should not occur in years ending in '00', unless divisible by
400. ( 365.2475 days per year)

A modern estimate of a calendar year is 365.24219 rotations of Earth per
solar year.
Calendar days since 46BC
46BC = 366
(( 2004 + 46) * 365) = 748250
(( 2004 + 46) / 4) = 512
( 1600, 2000) = -2
= 749126

Actual days since 46BC
( 2004 + 47) * 365.24219
= 749111.73169

Accumulated error
= 14.26831

Using the Gregorian Calendar accumulates about 5 Earth rotational day error
for every thousand solar years.

An even more modern calendar error correction rule can be stated as,
add one day every four years, using February 29th, unless the year is
exactly divisible by 128. ( 365.2421875) This may accumulate 1 Earth
rotational day error for every hundred thousand solar years.
Jul 17 '05 #1
4 2402 Excatly which years, or even whether 46BC was a leap year,
is not certain according to historians.

http://www.tondering.dk/claus/calendar.html

maw
Jul 17 '05 #2
/*

program: leap1
description: test for leap year accuracy, adjusts for Earth's rotational rate,
assumed to be constantly decreasing.

Gregorian calendar method is more accurate thru year 100,000
Whereas, a modulo 128 method accumulates 31 days of error in 100,000 years.

maw
makerun leap1 50000 100000

adding: leap1.class (in=1663) (out=938) (deflated 43%)
Year = 50000
Days Float0 = 1.8262178498500004E7
Days Float1 = 1.8262178353000224E7
Days Gregorian = 18262125
Days intDays1 = 18262110
Year = 100000
Days Float0 = 3.652450699700001E7
Days Float1 = 3.652450670599856E7
Days Gregorian = 36524250
Days intDays1 = 36524219

*/
import java.io.*;

public class leap1
{
static double earthRotationsPerYear0 = 365.24207;
static double earthRotationsYearIncrement = 0.00000006;
static double earthRotations100YearIncrement = 0.000006;
private static void leapTest( long yearModulo, long yearStop) {
long intDays0 = 0;
long intDays1 = 0;
double floatDays0 = 0.0;
double floatDays1 = 0.0;
double floatDays1PerYearIncrement = earthRotationsPerYear0;

for( long i=0; i<yearStop; i++) {

floatDays0 += earthRotationsPerYear0 + (i * earthRotationsYearIncrement);

if ((( i+1) % 100) == 0)
floatDays1PerYearIncrement += earthRotations100YearIncrement;
floatDays1 += floatDays1PerYearIncrement;

intDays0 += 365;
if ((( i+1) % 4) == 0) {
if ((( i+1) % 100) != 0)
intDays0++;
else if ((( i+1) % 400) == 0)
intDays0++;
}

intDays1 += 365;
if ( ((( i+1) % 4) == 0) &&
((( i+1) % 128) != 0) )
intDays1++;

if ((( i+1) % yearModulo) == 0) {
System.out.println( " Year = " + (i+1) );
System.out.println( " Days Float0 = " + floatDays0 );
System.out.println( " Days Float1 = " + floatDays1 );
System.out.println( " Days Gregorian = " + intDays0 );
System.out.println( " Days intDays1 = " + intDays1 );

}
} // end for
} // end leapTest

public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: java leap1 " +
"<year modulo> <year end>");
}
else {
try {
leapTest( Long.parseLong( args, 10), Long.parseLong( args, 10) );
} catch (Exception e) {
System.err.println(
"Exception Error:" + e.getMessage());
}
}
}

} // End of public class leap1
Jul 17 '05 #3
/*

program: leap2
date: Monday, March 1st, 2004
description: test for leap year accuracy, adjusts for Earth's rotational rate,
assumed to be constantly decreasing.

for leap year skip calculation, mod 128 is more accurate than Gregorian method

maw
makerun leap2 5000 15000

adding: leap2.class (in=1665) (out=937) (deflated 43%)
Year = 5000
Days Float0 = 1826210.8001499996
Days Float1 = 1826210.8147000133
Days Gregorian = 1826212
Days intDays1 = 1826211
Year = 10000
Days Float0 = 3652420.1002999996
Days Float1 = 3652420.1293999623
Days Gregorian = 3652425
Days intDays1 = 3652422
Year = 15000
Days Float0 = 5478627.90045
Days Float1 = 5478627.944100051
Days Gregorian = 5478637
Days intDays1 = 5478633

*/

import java.io.*;

public class leap2
{
static double earthRotationsPerYear0 = 365.24231;
static double earthRotationsYearDecrement = 0.00000006;
static double earthRotations100YearDecrement = 0.000006;
private static void leapTest( long yearModulo, long yearStop) {
long intDays0 = 0;
long intDays1 = 0;
double floatDays0 = 0.0;
double floatDays1 = 0.0;
double floatDays1PerYearDecrement = 0.0;

for( long i=0; i<yearStop; i++) {

floatDays0 += earthRotationsPerYear0 - (i * earthRotationsYearDecrement);

if ((( i+1) % 100) == 0)
floatDays1PerYearDecrement += earthRotations100YearDecrement;
floatDays1 += earthRotationsPerYear0 - floatDays1PerYearDecrement;

intDays0 += 365;
if ((( i+1) % 4) == 0) {
if ((( i+1) % 100) != 0)
intDays0++;
else if ((( i+1) % 400) == 0)
intDays0++;
}
intDays1 += 365;
if ((( i+1) % 4) == 0) {
if ((( i+1) % 128) != 0)
intDays1++;
}

if ((( i+1) % yearModulo) == 0) {
System.out.println( " Year = " + (i+1) );
System.out.println( " Days Float0 = " + floatDays0 );
System.out.println( " Days Float1 = " + floatDays1 );
System.out.println( " Days Gregorian = " + intDays0 );
System.out.println( " Days intDays1 = " + intDays1 );

}
} // end for
} // end leapTest

public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: java leap2 " +
"<year modulo> <year end>");
}
else {
try {
leapTest( Long.parseLong( args, 10), Long.parseLong( args, 10) );
} catch (Exception e) {
System.err.println(
"Exception Error:" + e.getMessage());
}
}
}

} // End of public class leap2
Jul 17 '05 #4
Mark A. Washburn wrote:
The Julian Calendar, adopted in 46BC by Julius Caesar, adds one day every
four years to correct for the fact that Earth's solar year is slightly more
than 365 of Earth's daily rotations. ( 365.25 days per year)

The Gregorian Calendar, adopted in 1582 by Pope Gregory XIII, ordered that
leap years should not occur in years ending in '00', unless divisible by
400. ( 365.2475 days per year)

A modern estimate of a calendar year is 365.24219 rotations of Earth per
solar year.
Calendar days since 46BC
46BC = 366
(( 2004 + 46) * 365) = 748250
(( 2004 + 46) / 4) = 512
( 1600, 2000) = -2
= 749126
You forgot the 11 days they nicked off us in 1752 or whenever it was in
your bit of the world. And by the way, it's the hundreds that weren't
leap years that you should be subtracting, not the hundreds that were
leap years.

<snip> An even more modern calendar error correction rule can be stated as,
add one day every four years, using February 29th, unless the year is
exactly divisible by 128. ( 365.2421875) This may accumulate 1 Earth
rotational day error for every hundred thousand solar years.

That wouldn't exactly border on being backward compatible. OTOH, if we
try correcting the Gregorian, rather than the Julian.

Let's look at the Gregorian more simply.

Calendar days from 1 to 2000:
2000 * 365 = 730000
2000 / 4 = 500
-2000 / 100 = -20
2000 / 400 = 5

Total = 730485

Actual days from 1 to 2000:
= 730484.38

So as of 1 Jan 2001, we're only .62 of a day out. So if we dropped a
leap year every 3200 years on the Gregorian, we'd have:

Calendar days from 1 to 3200:
3200 * 365 = 1168000
3200 / 4 = 800
-3200 / 100 = -32
3200 / 400 = 8
-3200 / 3200 = -1

Total = 1168775

Actual days from 1 to 3200:
= 1168775.008

This'll be plenty of time for the world to fix any Y3.2K problems.

And then for your (great-){15998,39998}grandchildren, drop another leap
year every 400000 years. Then our calendar'll be perfect. :-)

Stewart.

--
My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment. Please keep
replies on the 'group where everyone may benefit.
Jul 17 '05 #5

### This discussion thread is closed

Replies have been disabled for this discussion.