Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #382975 > unrolled thread
| Started by | porkchop@invalid.foo (Mike Sanders) |
|---|---|
| First post | 2024-02-24 21:15 +0000 |
| Last post | 2024-03-03 10:23 -0800 |
| Articles | 4 on this page of 64 — 16 participants |
Back to article view | Back to comp.lang.c
Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-24 21:15 +0000
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-24 22:54 +0000
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-24 23:57 +0100
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-24 23:02 +0000
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-25 02:00 +0100
Re: Calculate date of Easter or Good Friday Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-25 02:27 +0000
Re: Calculate date of Easter or Good Friday Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-02-25 16:58 +0000
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-25 18:50 +0100
Re: Calculate date of Easter or Good Friday Dan Purgert <dan@djph.net> - 2024-02-26 12:43 +0000
Re: Calculate date of Easter or Good Friday Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-24 18:00 -0800
Re: Calculate date of Easter or Good Friday Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2024-02-26 11:24 -0700
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-26 23:20 +0000
Re: Calculate date of Easter or Good Friday scott@slp53.sl.home (Scott Lurndal) - 2024-02-26 23:31 +0000
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-27 12:50 +0100
Re: Calculate date of Easter or Good Friday James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-02-27 05:02 -0500
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 22:48 +0000
Re: Calculate date of Easter or Good Friday James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-02-27 19:06 -0500
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-28 00:11 +0000
Re: Calculate date of Easter or Good Friday James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-02-27 19:24 -0500
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-28 20:47 +0000
Re: Calculate date of Easter or Good Friday Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-28 14:06 -0800
Re: Calculate date of Easter or Good Friday Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-28 22:20 +0000
Re: Calculate date of Easter or Good Friday James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-02-29 13:21 -0500
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 22:50 +0000
Re: Calculate date of Easter or Good Friday James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-02-27 19:41 -0500
Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-28 13:13 +0100
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-25 01:33 +0000
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-25 06:20 +0000
Re: Calculate date of Easter or Good Friday G <g@nowhere.invalid> - 2024-02-26 09:47 +0000
Re: Calculate date of Easter or Good Friday Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2024-02-26 11:20 -0700
Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-27 10:08 +0100
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-27 13:00 +0100
Re: Calculate date of Easter or Good Friday Michael S <already5chosen@yahoo.com> - 2024-02-27 13:12 +0200
Re: Calculate date of Easter or Good Friday Michael S <already5chosen@yahoo.com> - 2024-02-27 14:36 +0200
Re: Calculate date of Easter or Good Friday Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-02-25 17:39 +0000
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-26 03:12 +0000
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 05:20 +0100
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-26 14:26 +0000
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 16:31 +0100
[OT] personal things (was Re: Calculate date of Easter or Good Friday) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 16:43 +0100
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-26 14:32 +0000
[OT] Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 17:10 +0100
Re: [OT] Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-26 18:26 +0100
Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-26 11:45 +0100
Re: Calculate date of Easter or Good Friday Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-02-26 13:04 +0000
Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-26 15:46 +0100
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 16:17 +0100
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 17:15 +0100
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-26 14:38 +0000
Re: Calculate date of Easter or Good Friday scott@slp53.sl.home (Scott Lurndal) - 2024-02-26 16:29 +0000
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-26 19:54 +0000
Re: Calculate date of Easter or Good Friday scott@slp53.sl.home (Scott Lurndal) - 2024-02-26 20:06 +0000
Re: Calculate date of Easter or Good Friday porkchop@invalid.foo (Mike Sanders) - 2024-02-26 21:18 +0000
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 00:59 +0000
Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-26 18:07 +0100
Re: Calculate date of Easter or Good Friday Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-26 16:09 +0100
Re: Calculate date of Easter or Good Friday Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2024-02-26 17:26 +0000
Re: Calculate date of Easter or Good Friday David Brown <david.brown@hesbynett.no> - 2024-02-27 10:17 +0100
Re: Calculate date of Easter or Good Friday Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-03 11:05 -0800
Re: Calculate date of Easter or Good Friday vallor <vallor@cultnix.org> - 2024-02-27 01:28 +0000
Re: Calculate date of Easter or Good Friday Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 02:25 +0000
Re: Calculate date of Easter or Good Friday Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-03 10:03 -0800
Re: Calculate date of Easter or Good Friday Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-02-28 01:54 +0000
Re: Calculate date of Easter or Good Friday Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-03-03 10:23 -0800
Page 4 of 4 — ← Prev page 1 2 3 [4]
| From | Lawrence D'Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2024-02-27 02:25 +0000 |
| Message-ID | <urjh78$2s2kn$1@dont-email.me> |
| In reply to | #383081 |
On Tue, 27 Feb 2024 01:28:53 -0000 (UTC), vallor wrote: > I really wish the function easterg() was commented better. I’m not really sure that longer symbol names would make anything clearer. Maths is like that: the important thing is the structure of the formula, not the names for the quantities in it.
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2024-03-03 10:03 -0800 |
| Message-ID | <868r2ztcox.fsf@linuxsc.com> |
| In reply to | #383081 |
vallor <vallor@cultnix.org> writes:
>> [...]
>
> ncal(1) has the -e and -o options for both Easters. I went looking
> for the source of the Easter-computation code, found one copy here:
>
> https://github.com/lattera/freebsd/blob/master/lib/libcalendar/easter.c
>
> On Ubuntu with source repositories enabled, one can get the BSD
> ncal (with its bundled libcalendar) with
>
> $ apt-get source ncal
>
> I really wish the function easterg() was commented better.
>
> /* Compute Easter Sunday in Gregorian Calendar */
> date *
> easterg(int y, date *dt)
> {
> int c, i, j, k, l, n;
>
> n = y % 19;
> c = y / 100;
> k = (c - 17) / 25;
> i = (c - c/4 -(c-k)/3 + 19 * n + 15) % 30;
> i = i -(i/28) * (1 - (i/28) * (29/(i + 1)) * ((21 - n)/11));
> j = (y + y/4 + i + 2 - c + c/4) % 7;
> l = i - j;
> dt->m = 3 + (l + 40) / 44;
> dt->d = l + 28 - 31*(dt->m / 4);
> dt->y = y;
> return (dt);
> }
>
> The code is 27 years old. I will not pretend to understand it.
> (Yet?)
Seems like bad style to have two assignments to 'i'. Easily
fixable simply by adding another variable.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2024-02-28 01:54 +0000 |
| Message-ID | <87sf1d8iav.fsf@bsb.me.uk> |
| In reply to | #383010 |
Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes: > On Sat, 24 Feb 2024 21:15:56 +0000, Mike Sanders wrote: > >> Calculate the date of Easter Sunday or Good Friday: >> >> https://busybox.neocities.org/notes/is-easter-or-goodfriday.txt > > I don't have the expertise to discuss whether or not your code > properly implements the calculations necessary to determine the > date of Good Friday and/or Easter. However, I /do/ have some > expertise on writing understandable code. > > My suggestions, with respect to your program, would be to > a) name your objects with relevant, understandable names > You code uses quite a lot of meaningless one-letter > objects, and it is difficult to keep track of the > purpose of the calculations using them. > b) Don't place your calculations /in/ the object initializations. > Doing so obfuscates the intent of the logic, and makes > problem determination and resolution difficult. I urge those making these suggestions to have a go at doing both. I suspect the result will be far less understandable. > Otherwise, it /appears/ to do the job. Good first attempt. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Tim Rentsch <tr.17687@z991.linuxsc.com> |
|---|---|
| Date | 2024-03-03 10:23 -0800 |
| Message-ID | <864jdntbso.fsf@linuxsc.com> |
| In reply to | #383130 |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes: > Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes: > >> On Sat, 24 Feb 2024 21:15:56 +0000, Mike Sanders wrote: >> >>> Calculate the date of Easter Sunday or Good Friday: >>> >>> https://busybox.neocities.org/notes/is-easter-or-goodfriday.txt >> >> I don't have the expertise to discuss whether or not your code >> properly implements the calculations necessary to determine the >> date of Good Friday and/or Easter. However, I /do/ have some >> expertise on writing understandable code. >> >> My suggestions, with respect to your program, would be to >> a) name your objects with relevant, understandable names >> You code uses quite a lot of meaningless one-letter >> objects, and it is difficult to keep track of the >> purpose of the calculations using them. >> b) Don't place your calculations /in/ the object initializations. >> Doing so obfuscates the intent of the logic, and makes >> problem determination and resolution difficult. > > I urge those making these suggestions to have a go at doing both. I > suspect the result will be far less understandable. I have the same reaction regarding point (b). Regarding point (a), I have mostly the same reaction, although in some cases I think there are meaningful names that could be given. Whether it is better to do that by changing variable names or by describing what's going on in a block comment is another matter. In my view the key issue here is not what names are used but the structure of the algorithm. Someone has taken a complicated set of integer relationships and put them into a meat grinder, with the result being a method that is (perhaps) computationally efficient but horribly difficult to follow. If the goal is understandability, I suggest taking a different approach so that both the method and the code itself are directly comprehensible.
[toc] | [prev] | [standalone]
Page 4 of 4 — ← Prev page 1 2 3 [4]
Back to top | Article view | comp.lang.c
csiph-web