Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #383266

Re: Calculate date of Easter or Good Friday

Path csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c
Subject Re: Calculate date of Easter or Good Friday
Date Sun, 03 Mar 2024 10:03:42 -0800
Organization A noiseless patient Spider
Lines 40
Message-ID <868r2ztcox.fsf@linuxsc.com> (permalink)
References <urdmac$1d3vr$1@dont-email.me> <urfu0e$1tvc8$2@dont-email.me> <urhq4h$2g5oc$1@dont-email.me> <urjdsl$2mmok$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info dont-email.me; posting-host="8e6876f3e46194a45503e9d93596105d"; logging-data="2754882"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fQQ4W4RPg8nrfYJdsME7DVHunu1DIgNw="
User-Agent Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock sha1:fGEbBgEWAK46jMzCkrS1u9nHMXA= sha1:gk2yGYa+YBuOs2GR5VJcOh4BSl8=
Xref csiph.com comp.lang.c:383266

Show key headers only | View raw


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.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web