URL / format fix 1996/schweikh1/README.md
This commit is contained in:
1 parent
591d8774ef
commit
231ab04074
1 file changed
+56
-36
+56
-36
@@ -1,20 +1,32 @@
|
||||
# Worst Abuse of the C Preprocessor
|
||||
|
||||
Jens Schweikhardt
|
||||
DFN Network Operation Center
|
||||
Schlartaeckerweg 3 (home address)
|
||||
D-71384 Weinstadt
|
||||
Germany
|
||||
|
||||
http://www.uni-stuttgart.de/People/schweikhardt/home.html
|
||||
Jens Schweikhardt
|
||||
DFN Network Operation Center
|
||||
Schlartaeckerweg 3 (home address)
|
||||
D-71384 Weinstadt
|
||||
Germany
|
||||
<http://www.schweikhardt.net>
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
```sh
|
||||
make all
|
||||
```
|
||||
|
||||
## To run:
|
||||
|
||||
./schweikh1
|
||||
```sh
|
||||
./schweikh1
|
||||
```
|
||||
|
||||
## Try:
|
||||
|
||||
To find the day that Easter falls on in the current year:
|
||||
|
||||
```sh
|
||||
./schweikh1 |grep $(date +%Y)
|
||||
```
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
@@ -27,18 +39,18 @@ C Preprocessor that the judges have seen this year!
|
||||
|
||||
## Author's remarks:
|
||||
|
||||
What this program does
|
||||
----------------------
|
||||
### What this program does
|
||||
|
||||
This program is an implementation of an algorithm that calculates
|
||||
the date of the Sunday following the first full moon after the
|
||||
spring equinoxe. (Also known as "Easter", defined this way by the
|
||||
spring equinox. (Also known as "Easter", defined this way by the
|
||||
Nicaean Concilium in 325 Anno Domini.) The algorithm is attributed
|
||||
to the famous mathematician Carl Friedrich Gauss ["Meyers Handbuch
|
||||
ueber das Weltall", Meyer, 5th Edition, 1973, p149] and is suitable
|
||||
for anni domini within the Gregorian Calendar, that is, from 1582 AD
|
||||
to 2199 AD:
|
||||
|
||||
```
|
||||
Let J be the year.
|
||||
If J is from 1582 to 1699, let M be 22, let N be 2
|
||||
If J is from 1700 to 1799, let M be 23, let N be 3
|
||||
@@ -51,29 +63,37 @@ Let c be the modulus of J divided by 7
|
||||
Let d be the modulus of (19a + M) divided by 30
|
||||
Let e be the modulus of (2b + 4c + 6d + N) divided by 7
|
||||
|
||||
```
|
||||
|
||||
The interesting Sunday is either:
|
||||
|
||||
March 22 + d + e or
|
||||
April d + e - 9 (only one of them is a valid date)
|
||||
|
||||
```
|
||||
March 22 + d + e or
|
||||
April d + e - 9 (only one of them is a valid date)
|
||||
```
|
||||
|
||||
with the following exceptions:
|
||||
|
||||
April 26 must always be changed to April 19
|
||||
April 25 must be changed to April 18 if d is 28 and a greater than 10
|
||||
```
|
||||
April 26 must always be changed to April 19
|
||||
April 25 must be changed to April 18 if d is 28 and a greater than 10
|
||||
```
|
||||
|
||||
### Example:
|
||||
|
||||
J = 1962, M = 24, N = 5
|
||||
a = J % 19 = 5
|
||||
b = J % 4 = 2
|
||||
c = J % 7 = 2
|
||||
d = 119 % 30 = 29
|
||||
e = 191 % 7 = 2
|
||||
|
||||
March 53 is invalid, so the result is April 22 1962
|
||||
```
|
||||
J = 1962, M = 24, N = 5
|
||||
a = J % 19 = 5
|
||||
b = J % 4 = 2
|
||||
c = J % 7 = 2
|
||||
d = 119 % 30 = 29
|
||||
e = 191 % 7 = 2
|
||||
```
|
||||
|
||||
Why I think this is obfuscated
|
||||
------------------------------
|
||||
March 53 is invalid, so the result is April 22 1962.
|
||||
|
||||
|
||||
### Why I think this is obfuscated
|
||||
|
||||
Apart from the calculation of the Easter date, the definition *and*
|
||||
calculation of which are obfuscations in their own right,
|
||||
@@ -101,22 +121,22 @@ Try to be as precise as can be and no one will comprehend what you mean.
|
||||
#### The formula:
|
||||
|
||||
|
||||
comprehension = 1/(2**precision)
|
||||
```
|
||||
comprehension = 1/(2**precision)
|
||||
```
|
||||
|
||||
#### The interpretation:
|
||||
|
||||
"Say nothing and everybody will understand."
|
||||
|
||||
The `-I/usr/include` in the build file is needed by gcc on Solaris because
|
||||
gcc's "fixed" header in gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h
|
||||
is broken (sort of) because it has *two* identical extern
|
||||
declarations of errno. This leads to an error due to the
|
||||
redefinition of main. The `-I` option makes sure the working
|
||||
/usr/include/errno.h is found first, which shouldn't harm on other
|
||||
systems.
|
||||
`gcc`'s "fixed" header in `gcc-lib/sparc-sun-solaris2.5/2.7.2/include/errno.h`
|
||||
is broken (sort of) because it has *two* identical extern declarations of errno.
|
||||
This leads to an error due to the redefinition of main. The `-I` option makes
|
||||
sure the working /usr/include/errno.h is found first, which shouldn't cause any
|
||||
problems on other systems.
|
||||
|
||||
Usage
|
||||
-----
|
||||
### Usage
|
||||
|
||||
The program is run without arguments. It prints all dates in order.
|
||||
|
||||
|
||||
Reference in new issue
Block a user