• Calculate date of Easter or Good Friday

    From Mike Sanders@21:1/5 to All on Sat Feb 24 21:15:56 2024
    Calculate the date of Easter Sunday or Good Friday:

    https://busybox.neocities.org/notes/is-easter-or-goodfriday.txt

    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Sat Feb 24 23:57:16 2024
    On 24.02.2024 23:54, Lawrence D'Oliveiro wrote:
    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that Easter
    would never coincide with Passover? Because the sight of Christians celebrating together with Jews was seen as heretical or something ...

    ... and that there's not a unique definition of Easter.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Janis Papanagnou on Sat Feb 24 23:02:36 2024
    On Sat, 24 Feb 2024 23:57:16 +0100, Janis Papanagnou wrote:

    ... and that there's not a unique definition of Easter.

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for their
    own propaganda purposes.

    Just like they took a lot of existing pagan deities (e.g. in Celtic lands)
    and reinvented them as “saints”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Mike Sanders on Sat Feb 24 22:54:37 2024
    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that Easter
    would never coincide with Passover? Because the sight of Christians
    celebrating together with Jews was seen as heretical or something ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lawrence D'Oliveiro on Sun Feb 25 02:00:43 2024
    On 25.02.2024 00:02, Lawrence D'Oliveiro wrote:
    On Sat, 24 Feb 2024 23:57:16 +0100, Janis Papanagnou wrote:

    ... and that there's not a unique definition of Easter.

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for their
    own propaganda purposes.

    Yes, the associated rites were of pagan origin. The dates of Easter -
    the topic here - still not unique. There's different calculations for
    different christian churches; the catholics calculate it differently
    from the orthodox christians, still today. - So Easter is peobably
    not a good choice for a C program calculation if not parameterized or explicitly documented to be restricted to only one specific religious
    culture.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to Lawrence D'Oliveiro on Sun Feb 25 01:33:35 2024
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:

    Did you know that one of the requirements of the rules was that Easter
    would never coincide with Passover? Because the sight of Christians celebrating together with Jews was seen as heretical or something ...

    Oh yeah, lots of horror stories committed by & against the 'us & them'.
    Isn't a culture on the planet, so far as I can see, that has not been
    both prey & predacious. I want to say something like 'that's life',
    but its not a very satisfying reply...

    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Janis Papanagnou on Sun Feb 25 02:27:47 2024
    On 2024-02-25, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 25.02.2024 00:02, Lawrence D'Oliveiro wrote:
    On Sat, 24 Feb 2024 23:57:16 +0100, Janis Papanagnou wrote:

    ... and that there's not a unique definition of Easter.

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for their
    own propaganda purposes.

    Yes, the associated rites were of pagan origin.

    Pretty much all Christian celebrations are hijacks of pagan ones.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Mike Sanders on Sun Feb 25 06:20:19 2024
    On Sun, 25 Feb 2024 01:33:35 -0000 (UTC), Mike Sanders wrote:

    Oh yeah, lots of horror stories committed by & against the 'us & them'.
    Isn't a culture on the planet, so far as I can see, that has not been
    both prey & predacious. I want to say something like 'that's life', but
    its not a very satisfying reply...

    You know how most of these religions have, as one of their core
    principles, that “our god is the only true god, all other gods are false”?

    If they would all agree to get rid of that, it would be a good step on the
    road to religious tolerance.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Janis Papanagnou on Sun Feb 25 16:58:56 2024
    On Sun, 25 Feb 2024 02:00:43 +0100, Janis Papanagnou wrote:

    On 25.02.2024 00:02, Lawrence D'Oliveiro wrote:
    On Sat, 24 Feb 2024 23:57:16 +0100, Janis Papanagnou wrote:

    ... and that there's not a unique definition of Easter.

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for their
    own propaganda purposes.

    Yes, the associated rites were of pagan origin. The dates of Easter -
    the topic here - still not unique. There's different calculations for different christian churches; the catholics calculate it differently
    from the orthodox christians, still today.

    As some countries recognize Good Friday and/or Easter Sunday as
    statutory holidays, and have /legal/ definitions for those dates.

    For instance, the Government of Canada defines Easter Sunday as
    "the first Sunday after the first full moon in spring (after March 21st)".
    (I don't know if this coincides with /any/ religious definition or not.)

    So Easter is peobably
    not a good choice for a C program calculation if not parameterized or explicitly documented to be restricted to only one specific religious culture.




    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to Mike Sanders on Sun Feb 25 17:39:27 2024
    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.

    Otherwise, it /appears/ to do the job. Good first attempt.
    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Lew Pitcher on Sun Feb 25 18:50:35 2024
    On 25.02.2024 17:58, Lew Pitcher wrote:
    On Sun, 25 Feb 2024 02:00:43 +0100, Janis Papanagnou wrote:

    [...] There's different calculations for
    different christian churches; the catholics calculate it differently
    from the orthodox christians, still today.

    As some countries recognize Good Friday and/or Easter Sunday as
    statutory holidays, and have /legal/ definitions for those dates.

    For instance, the Government of Canada defines Easter Sunday as
    "the first Sunday after the first full moon in spring (after March 21st)".
    (I don't know if this coincides with /any/ religious definition or not.)

    In Germany it's also legally defined. But it's difficult.

    First, most holidays (but one) are defined not on the country level
    but individually at states level, but there's still common holidays
    across all states. This is not surprising since the states have
    different predominant religious variants in their population, so the "protestant countries" have not the same holidays as the "catholic
    countries" (and the orthodox, for example, are not represented in
    the legislation at all, e.g. when concerning Easter), and there are
    also other state specific holidays. And even within a state there's
    regional differences. There are also legislative special rules, e.g.
    for Israeli holidays, that Germans have to respect, and that provide
    more free time for people of this religious orientation.

    Then there's a distinction of fixed and varying holidays. Easter is
    from the latter, while Christmas from the former.

    And, IIUC, the actual dates rely on a "Church Year", which differs
    between catholics/protestants and orthodox christians.

    I can't say whether the legislation is referring to some churches'
    documents and/or definitions, but it's more likely they copied such
    definitions into the legislative texts, since people must be able to
    rely on legislative texts. But on a quick view into the Bavarian law
    I could not find the Christian holidays listed by date; they are just
    referred to by their name.

    It's complex.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to Lew Pitcher on Mon Feb 26 03:12:20 2024
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:

    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.

    One thing while I'm thinking about it: allot of discussion up-thread
    failed to note that officially mandated Easter dating is really
    based a Lunar date mapped onto the Gregorian calendar. Yet another
    layer of abstraction.

    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.

    Otherwise, it /appears/ to do the job. Good first attempt.

    Thanks Lew appreciate the helpful comments, still a newbie,
    I move forward if ever so slowly.

    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Mike Sanders on Mon Feb 26 05:20:55 2024
    On 26.02.2024 04:12, Mike Sanders wrote:

    One thing while I'm thinking about it: allot of discussion up-thread
    failed to note that officially mandated Easter dating is really
    based a Lunar date mapped onto the Gregorian calendar. [...]

    Not sure which instance of "official" you are referring to; there's
    just no "official" mandate unless you are restricting yourself to a
    global authority instance (which does not exist) or not considering
    that any single instance cannot define a "general" rule that would
    be valid worldwide. Face it; Easter dates just differ on this planet!

    The "western" churches switched to Gregorian calendar while the
    "eastern" churches stayed with the Julian _to calculate the Easter
    date_. (Both based on lunar constellation, but that's irrelevant.)

    I suggest to leave your country, visit (for example) Greece, and ask
    the people there what they think about your definition. Or take the
    simple approach; inspect Wikipedia or other established encyclopedias.

    And both dates, western and eastern, are anyway arbitrary. But if you
    decide to neglect the existing facts, either by wrongly assuming that
    there's only one "correct" Easter date, or by (arrogantly?) presuming
    that one is more correct than the other, then you are discriminating
    Christian folks that follow the one [arbitrary] definition (or the
    other).

    Janis

    PS: Just to prevent you from a fallacy; for the date calculation of
    Easter it's irrelevant whether "we" have "now" switched to Gregorian
    calendar [mostly]. (Think about it before you step into that pit.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From G@21:1/5 to Lawrence D'Oliveiro on Mon Feb 26 09:47:12 2024
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that Easter
    would never coincide with Passover? Because the sight of Christians celebrating together with Jews was seen as heretical or something ...

    I have never heard of this one and I don't think it's true...

    Easter is a day while passover last eight days and it happens that one of
    those days is the easter sunday as in 2022 when passover started April 15 and ester was April 17.

    The calculation of easter is quite complex and use the "epact" and "golden number" associated to the year, but the short answer "the first sunday after the full moon after the spring equinox" usually gives the right answer.
    Just remember that it is the "official spring equinox" March 21 and not the "real" one that can happen on the 19,20(usually, like this year)
    or 21 and the "official full moon" that can differ one or two days from the "real".

    For a full discussion see: <https://www.tondering.dk/claus/cal/easter.php>, part of "The Calendar FAQ".

    G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Lew Pitcher on Mon Feb 26 11:45:36 2024
    On 25/02/2024 18:39, Lew Pitcher wrote:
    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.

    I agree here.

    I'd also avoid single-letter capital letter variables, and avoid
    single-letter variables that are easily misread (so don't use "L" or
    "O", big or small). Single-letter variables are fine if their scope is
    small and their meaning is clear - such as "i" for a loop variable, and
    "x" and "y" for coordinates.

    Good names here, together with some comments, would go a long way to
    making it possible to understand your algorithm here. Links to web
    pages for reference are useful (and it's always polite to give your references), but remember that web pages don't last for ever - try to
    make your code stand alone as code, or at least have enough comments to
    cover the information.

    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'd disagree with that one. Initialise your variables when you have
    something to put in them, and that is often a calculated value.


    Otherwise, it /appears/ to do the job. Good first attempt.

    Some other suggestions:

    Don't use "int" when you mean "bool". That applies to parameters,
    return types, and variables.

    Don't have one function that appears to do two different things. It's
    much better to have "isEaster()" and "isGoodFriday()" functions.
    Clearly these are heavily related, so have a static helper function that
    does the common calculations.

    Consider making and using several general functions, rather than having
    a single impenetrable function. You might have a "numberOfDaysInYear()" function, and functions for converting (day, month) pairs back and forth
    to the number of days since the first of January. You can have lunar calculations also based on the number of days from a given starting
    point (perhaps using Unix epoch time rather than struct tm). Then you
    can have a "findEaster()" function that returns the date of Easter for a
    given year as the number of days from the first of January.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to David Brown on Mon Feb 26 13:04:14 2024
    David Brown <david.brown@hesbynett.no> writes:

    On 25/02/2024 18:39, Lew Pitcher wrote:
    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.

    I agree here.

    I challenge the "use better names" to try it. The trouble with this
    sort of code is, I suspect, that the quantities don't correspond to
    anything that can be clearly named. I may be wrong as I don't know this
    form, but it true of the much better known Zeller's Congruence.

    I think the correct way to present an algorithm like this if to include
    a block comment than documents and explains the formula (using whatver
    names are conventional), followed by code that uses the same names to do
    the calculation.

    I'd also avoid single-letter capital letter variables, and avoid single-letter variables that are easily misread (so don't use "L" or "O",
    big or small). Single-letter variables are fine if their scope is small
    and their meaning is clear - such as "i" for a loop variable, and "x" and
    "y" for coordinates.

    In this case, I would use the conventional names (if there are any) even
    if this violates the usual programming conventions. All supposing that
    the formula has been explained in a comment using exactly those names.

    Good names here, together with some comments, would go a long way to making it possible to understand your algorithm here.

    Have you tried? It may well detract from the explanations in the
    references. (I am hoping that the referenced URLs explain the formula.)

    Links to web pages for
    reference are useful (and it's always polite to give your references), but remember that web pages don't last for ever - try to make your code stand alone as code, or at least have enough comments to cover the information.

    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'd disagree with that one. Initialise your variables when you have something to put in them, and that is often a calculated value.

    Yes, and I'd make them all const to show that they just name quantities
    to simplify later calculations. That would force the adjustments to the
    day, month and year (to get good Friday) to be in another function. The logical one would be a separate test function for that date (as you have suggested):

    Don't have one function that appears to do two different things.

    Yes. I was taught a phrase about function arguments: "pass data not
    control".

    It's much
    better to have "isEaster()" and "isGoodFriday()" functions. Clearly these
    are heavily related, so have a static helper function that does the common calculations.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Purgert@21:1/5 to Lew Pitcher on Mon Feb 26 12:43:03 2024
    On 2024-02-25, Lew Pitcher wrote:
    On Sun, 25 Feb 2024 02:00:43 +0100, Janis Papanagnou wrote:
    [...]
    Yes, the associated rites were of pagan origin. The dates of Easter -
    the topic here - still not unique. There's different calculations for
    different christian churches; the catholics calculate it differently
    from the orthodox christians, still today.

    As some countries recognize Good Friday and/or Easter Sunday as
    statutory holidays, and have /legal/ definitions for those dates.

    For instance, the Government of Canada defines Easter Sunday as
    "the first Sunday after the first full moon in spring (after March 21st)".
    (I don't know if this coincides with /any/ religious definition or not.)

    Close enough to Catholic -- "First Sunday after the first full moon
    after the Spring Equinox".

    Equinox is on the 19th, first full moon is the 31st. Should line up (at
    least this year).


    --
    |_|O|_|
    |_|_|O| Github: https://github.com/dpurgert
    |O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to Janis Papanagnou on Mon Feb 26 14:32:30 2024
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    And both dates, western and eastern, are anyway arbitrary. But if you
    decide to neglect the existing facts, either by wrongly assuming that
    there's only one "correct" Easter date, or by (arrogantly?) presuming
    that one is more correct than the other, then you are discriminating Christian folks that follow the one [arbitrary] definition (or the
    other).

    And what's this? c'mon now, there's nothing arrogant or presumptuous here.
    I'm not discriminating against anyone (I'm Catholic if it makes a difference). Now then - don't start an argument where there is none...

    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to Janis Papanagnou on Mon Feb 26 14:26:14 2024
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    Not sure which instance of "official" you are referring to; there's
    just no "official" mandate unless you are restricting yourself to a
    global authority instance (which does not exist) or not considering
    that any single instance cannot define a "general" rule that would
    be valid worldwide. Face it; Easter dates just differ on this planet!

    The inference is the 'official' governance of a given municipality or
    provence using the Gregorian calendar (updated the URL notes last night
    to, I hope, clarify)...

    PS: Just to prevent you from a fallacy; for the date calculation of
    Easter it's irrelevant whether "we" have "now" switched to Gregorian
    calendar [mostly]. (Think about it before you step into that pit.)

    Not me =) I'm not touching the Julian variant, heck I got lucky (and
    spent way too much time) with the one I cobbled together as it is.

    So tell me, what are you coding these days? Haven't seen much from you lately...

    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Ben Bacarisse on Mon Feb 26 15:46:16 2024
    On 26/02/2024 14:04, Ben Bacarisse wrote:
    David Brown <david.brown@hesbynett.no> writes:

    On 25/02/2024 18:39, Lew Pitcher wrote:
    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.

    I agree here.

    I challenge the "use better names" to try it. The trouble with this
    sort of code is, I suspect, that the quantities don't correspond to
    anything that can be clearly named. I may be wrong as I don't know this form, but it true of the much better known Zeller's Congruence.

    Yes, I realise that's likely to be a problem here. For variables that
    exist solely to break up a long complicated calculation into manageable
    parts, good names are hard or impossible.

    However, I would guess - without having looked at the details of the
    algorithm - that this could be split into parts that are a bit clearer,
    and at least some of the variables could then have names showing what's
    going on. You might have the offset into the lunar month, or the number
    of days in February, or a boolean for before/after the spring equinox.

    If the expressions can only be split in somewhat arbitrary positions,
    and therefore the variables have arbitrary and meaningless names, so be
    it. But if it is possible and practical to do better, then I'd
    recommend that.


    I think the correct way to present an algorithm like this if to include
    a block comment than documents and explains the formula (using whatver
    names are conventional), followed by code that uses the same names to do
    the calculation.

    That is something I also suggested (without the detail of the names).


    I'd also avoid single-letter capital letter variables, and avoid
    single-letter variables that are easily misread (so don't use "L" or "O",
    big or small). Single-letter variables are fine if their scope is small
    and their meaning is clear - such as "i" for a loop variable, and "x" and
    "y" for coordinates.

    In this case, I would use the conventional names (if there are any) even
    if this violates the usual programming conventions. All supposing that
    the formula has been explained in a comment using exactly those names.


    Agreed. Clear and understandable code is more important than
    conventions. (But names like "l" or "O" are rarely clear, even if they
    are used in the context of the documentation of an algorithm.)

    Good names here, together with some comments, would go a long way to making >> it possible to understand your algorithm here.

    Have you tried? It may well detract from the explanations in the
    references. (I am hoping that the referenced URLs explain the formula.)

    Links to web pages for
    reference are useful (and it's always polite to give your references), but >> remember that web pages don't last for ever - try to make your code stand
    alone as code, or at least have enough comments to cover the information.

    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'd disagree with that one. Initialise your variables when you have
    something to put in them, and that is often a calculated value.

    Yes, and I'd make them all const to show that they just name quantities
    to simplify later calculations. That would force the adjustments to the
    day, month and year (to get good Friday) to be in another function.

    Agreed - I think it is often clearer to have const variables that are
    set once and never changed, so that you can always see exactly what
    value they have, and when it is set.

    The
    logical one would be a separate test function for that date (as you have suggested):

    Don't have one function that appears to do two different things.

    Yes. I was taught a phrase about function arguments: "pass data not control".


    That's a good way to put it.

    It's much
    better to have "isEaster()" and "isGoodFriday()" functions. Clearly these
    are heavily related, so have a static helper function that does the common >> calculations.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Mon Feb 26 16:09:36 2024
    On 26.02.2024 11:45, David Brown wrote:
    On 25/02/2024 18:39, Lew Pitcher wrote:
    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

    [...]

    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.

    [...]

    Good names here, together with some comments, would go a long way to
    making it possible to understand your algorithm here. Links to web
    pages for reference are useful (and it's always polite to give your references), but remember that web pages don't last for ever - try to
    make your code stand alone as code, or at least have enough comments to
    cover the information.

    Yes. Often it is the case that some magic formula is just copied
    from some place without knowledge. (I suspect here too.) At least
    a reference of the source of the formula should be provided with
    the code! (At first glance it seems to be the so called Spencer's
    formula [1922], published by someone else already in 1876.[*])

    Over the years there had been many formulas, variants, refinements
    introducing correction factors, etc. In the Wikipedias you should
    find enough information[**].


    Consider making and using several general functions, rather than having
    a single impenetrable function. You might have a "numberOfDaysInYear()" function, and functions for converting (day, month) pairs back and forth
    to the number of days since the first of January. You can have lunar calculations also based on the number of days from a given starting
    point (perhaps using Unix epoch time rather than struct tm). Then you
    can have a "findEaster()" function that returns the date of Easter for a given year as the number of days from the first of January.

    I'd expect that formulating the algorithm/formula using FP numbers
    could probably make it also a bit simpler. (But I haven't tried.)
    If you consider the actual task you observe that you somehow have
    to map the lunar period (~30 d) to the sun period (~365 d), where
    these cycles are not exact (not integral) and they are numerically
    not synchronous, plus the weekday mapping (actually a third cycle,
    in the calculation, here of integral type). This whole set of scalar
    integers seem to emulate these inherent issues as correction factors
    and few of them will represent real world entities.

    Janis

    [*] https://de.wikipedia.org/wiki/Spencers_Osterformel

    [**] I picked the links from the German Wikipedia - apologies for
    that - but I think that articles like these should be available in
    other languages as well if you search for the respective keywords.
    Easter date (also listing the two prevalent Easter definitions): https://de.wikipedia.org/wiki/Osterdatum
    Easter computation (mentioning also the necessary corrections): https://de.wikipedia.org/wiki/Computus_(Osterrechnung)
    Gauss' formulas and historic: https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel
    And a general article about Easter (for the cultural basics): https://de.wikipedia.org/wiki/Ostern

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to David Brown on Mon Feb 26 14:38:41 2024
    David Brown <david.brown@hesbynett.no> wrote:

    Don't use "int" when you mean "bool". That applies to parameters,
    return types, and variables.

    But I dont mean bool, I mean int, because the function (well my
    private code at any rate) now includes other Holi/Holy days:

    int foo(const struct tm *now, int hDay);

    switch (hDay)...

    But you all still raise some good points.

    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Mon Feb 26 16:17:12 2024
    On 26.02.2024 15:46, David Brown wrote:

    Yes, I realise that's likely to be a problem here. For variables that
    exist solely to break up a long complicated calculation into manageable parts, good names are hard or impossible.

    However, I would guess - without having looked at the details of the algorithm - that this could be split into parts that are a bit clearer,

    Unfortunately not, I fear.

    and at least some of the variables could then have names showing what's
    going on. You might have the offset into the lunar month, or the number
    of days in February, or a boolean for before/after the spring equinox.

    You seem to have chosen a source where "Spencer's" algorithm is
    described. In a corresponding Wikipedia article (here in German:
    e.g. https://de.wikipedia.org/wiki/Spencers_Osterformel)
    you find the same non-descriptive names.


    If the expressions can only be split in somewhat arbitrary positions,
    and therefore the variables have arbitrary and meaningless names, so be
    it. But if it is possible and practical to do better, then I'd
    recommend that.

    If you put in a reference to the document source - while not
    explaining anything - that might suffice. Otherwise you'd have
    to spend more effort describing the variables in detail.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Mike Sanders on Mon Feb 26 16:43:39 2024
    On 26.02.2024 15:26, Mike Sanders wrote:

    So tell me, what are you coding these days? Haven't seen much from you lately...

    Wasn't it you who asked me (probably in the Awk newsgroup) to create
    a web page (or use github) to post all my tools? - If so then I'm
    surprised that you're asking again since I already told you that I
    don't post my personal projects unless there's a concrete demand.

    Have you any concrete demands for some code? - The please tell me
    and I'll see whether I can provide something for you.

    Janis

    PS: I acknowledge if you seem to have some urge to post lots of code
    (as I recall from the Awk NG), and that's fine - despite I'd wished
    you'd take more care in quality, but since it's your code you define
    the rules for your code (amount, frequency, quality). From me you'll
    get hints and suggestions, and that's all.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Mike Sanders on Mon Feb 26 16:31:52 2024
    On 26.02.2024 15:26, Mike Sanders wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    Not sure which instance of "official" you are referring to; there's
    just no "official" mandate unless you are restricting yourself to a
    global authority instance (which does not exist) or not considering
    that any single instance cannot define a "general" rule that would
    be valid worldwide. Face it; Easter dates just differ on this planet!

    The inference is the 'official' governance of a given municipality or provence using the Gregorian calendar (updated the URL notes last night
    to, I hope, clarify)...

    (Despite my note you stepped into the fallacy trap.)

    One final try to help you here: Greece, like most other countries in
    the world, uses the Gregorian calendar. The Greek orthodox church, as
    just one example of eastern churches, has not changed the calculation
    for Easter. That's not a mistake.


    PS: Just to prevent you from a fallacy; for the date calculation of
    Easter it's irrelevant whether "we" have "now" switched to Gregorian
    calendar [mostly]. (Think about it before you step into that pit.)

    Not me =) I'm not touching the Julian variant, heck I got lucky (and
    spent way too much time) with the one I cobbled together as it is.

    The Wikipedia sources I provided elsethread show both existing Easter calculations that are in use world wide. So it's easy to reflect the
    real world in your code in a non-discriminating way. But if you prefer
    to ignore hundreds million orthodox Christians[*] that's of course
    completely your decision.

    Janis

    [*] https://de.wikipedia.org/wiki/Liste_der_L%C3%A4nder_nach_christlicher_Bev%C3%B6lkerung

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Janis Papanagnou on Mon Feb 26 17:15:05 2024
    've just noticed I was formulating it as if it was your code. Of course
    it was addressed at the author of the code. My apologies!


    On 26.02.2024 16:17, Janis Papanagnou wrote:
    On 26.02.2024 15:46, David Brown wrote:

    Yes, I realise that's likely to be a problem here. For variables that
    exist solely to break up a long complicated calculation into manageable
    parts, good names are hard or impossible.

    However, I would guess - without having looked at the details of the
    algorithm - that this could be split into parts that are a bit clearer,

    Unfortunately not, I fear.

    and at least some of the variables could then have names showing what's
    going on. You might have the offset into the lunar month, or the number
    of days in February, or a boolean for before/after the spring equinox.

    You seem to have chosen a source where "Spencer's" algorithm is
    described. In a corresponding Wikipedia article (here in German:
    e.g. https://de.wikipedia.org/wiki/Spencers_Osterformel)
    you find the same non-descriptive names.


    If the expressions can only be split in somewhat arbitrary positions,
    and therefore the variables have arbitrary and meaningless names, so be
    it. But if it is possible and practical to do better, then I'd
    recommend that.

    If you put in a reference to the document source - while not
    explaining anything - that might suffice. Otherwise you'd have
    to spend more effort describing the variables in detail.

    Janis


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Mike Sanders on Mon Feb 26 17:10:09 2024
    On 26.02.2024 15:32, Mike Sanders wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    And both dates, western and eastern, are anyway arbitrary. But if you
    decide to neglect the existing facts, either by wrongly assuming that
    there's only one "correct" Easter date, or by (arrogantly?) presuming
    that one is more correct than the other, then you are discriminating
    Christian folks that follow the one [arbitrary] definition (or the
    other).

    And what's this? c'mon now, there's nothing arrogant or presumptuous here. I'm not discriminating against anyone (I'm Catholic if it makes a difference).
    Now then - don't start an argument where there is none...

    While it may be personal arrogance (I can't tell; that's why I had put
    it in parenthesis and with a question mark) I had more the often
    observed "Western Arrogance" in mind. The country I'm living in is no
    exception here! Sadly we can observe (more often than desirable) that
    other cultures than the ones we are used to or living in are ignored,
    their culture despised or neglected.

    Speaking (in general contexts), say, only about male people will
    discriminate the female ones. Considering only the sexually straight
    people (is that word correct?) will discriminate the "LGBT..." folks. Disregarding non-Christian religions will discriminate the majority
    of religious people in the world. And if Christians exclude the
    Orthodox Christians it's also a discrimination.

    In case of the calendar issues even an unnecessary discrimination.

    Whether you are a Catholic or not might explain a preference, or may
    make some ignorance concerning other cultures understandable; I can't
    tell, and it's not the relevant point when we're speaking about any
    objective discrimination.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Mike Sanders on Mon Feb 26 18:07:48 2024
    On 26/02/2024 15:38, Mike Sanders wrote:
    David Brown <david.brown@hesbynett.no> wrote:

    Don't use "int" when you mean "bool". That applies to parameters,
    return types, and variables.

    But I dont mean bool, I mean int, because the function (well my
    private code at any rate) now includes other Holi/Holy days:

    int foo(const struct tm *now, int hDay);

    switch (hDay)...

    But you all still raise some good points.


    I can only comment on the code you've given. And "isLeapYear()", and "isEasterOrGoodFriday()" should both return "bool". The parameter "checkGoodFriday" should be bool too. (Actually, it should be scraped
    and the function split, as discussed on another branch.)

    And if you are returning "holiday type" from a function, it should not
    be "int" either - make it return an enumerated type.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Mike Sanders on Mon Feb 26 16:29:58 2024
    porkchop@invalid.foo (Mike Sanders) writes:
    David Brown <david.brown@hesbynett.no> wrote:

    Don't use "int" when you mean "bool". That applies to parameters,
    return types, and variables.

    But I dont mean bool, I mean int, because the function (well my
    private code at any rate) now includes other Holi/Holy days:

    int foo(const struct tm *now, int hDay);

    I would expect that an enumeration would be superior
    to an 'int' for this purpose.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to David Brown on Mon Feb 26 17:26:03 2024
    On Mon, 26 Feb 2024 11:45:36 +0100, David Brown wrote:

    On 25/02/2024 18:39, Lew Pitcher wrote:
    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
    [snip]
    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'd disagree with that one. Initialise your variables when you have something to put in them, and that is often a calculated value.

    I base my suggestion on the OP's source:
    int isEasterOrGoodFriday(const struct tm *now, int checkGoodFriday) {

    int Y = now->tm_year + 1900; // correcting the year
    int a = Y % 19;
    int b = Y / 100;
    int c = Y % 100;
    int d = b / 4;
    int e = b % 4;
    int f = (b + 8) / 25;
    int g = (b - f + 1) / 3;
    int h = (19 * a + b - d - g + 15) % 30;
    int i = c / 4;
    int k = c % 4;
    int L = (32 + 2 * e + 2 * i - h - k) % 7;
    int m = (a + 11 * h + 22 * L) / 451;
    int month = (h + L - 7 * m + 114) / 31;
    int day = ((h + L - 7 * m + 114) % 31) + 1;

    if (checkGoodFriday) {
    [rest of code elided]

    The program code /depends/ on the specific order of
    the declarations: <<Y>> /must/ be declared before <<a>>,
    <<a>> /must/ be declared before <<h>>, etc.

    If some good-meaning (or unknowledgable) maintainer decides to
    reorder or consolidate the above declarations, the program
    either fails or gives erroneous results.

    The OP embedded the /logic/ of the program within the declarations.
    That, to me. is /not/ good programming.

    Hope this helps clarify my earlier remarks.
    --
    Lew Pitcher
    "In Skills We Trust"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Janis Papanagnou on Mon Feb 26 18:26:53 2024
    On 26/02/2024 17:10, Janis Papanagnou wrote:
    On 26.02.2024 15:32, Mike Sanders wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

    And both dates, western and eastern, are anyway arbitrary. But if you
    decide to neglect the existing facts, either by wrongly assuming that
    there's only one "correct" Easter date, or by (arrogantly?) presuming
    that one is more correct than the other, then you are discriminating
    Christian folks that follow the one [arbitrary] definition (or the
    other).

    And what's this? c'mon now, there's nothing arrogant or presumptuous here. >> I'm not discriminating against anyone (I'm Catholic if it makes a difference).
    Now then - don't start an argument where there is none...

    While it may be personal arrogance (I can't tell; that's why I had put
    it in parenthesis and with a question mark) I had more the often
    observed "Western Arrogance" in mind. The country I'm living in is no exception here! Sadly we can observe (more often than desirable) that
    other cultures than the ones we are used to or living in are ignored,
    their culture despised or neglected.

    Speaking (in general contexts), say, only about male people will
    discriminate the female ones. Considering only the sexually straight
    people (is that word correct?) will discriminate the "LGBT..." folks. Disregarding non-Christian religions will discriminate the majority
    of religious people in the world. And if Christians exclude the
    Orthodox Christians it's also a discrimination.

    In case of the calendar issues even an unnecessary discrimination.

    Whether you are a Catholic or not might explain a preference, or may
    make some ignorance concerning other cultures understandable; I can't
    tell, and it's not the relevant point when we're speaking about any
    objective discrimination.

    Janis


    "Arrogance" is one possibility. But people may fail to include a given
    group for many different reasons, including (but not limited to) :

    1. Ignorance. Maybe the OP knows little or nothing about the Eastern
    Orthodox churches and when they have Easter. My guess is that many who
    know that much, do not know about Oriental Orthodox churches, and these
    are different from Eastern Orthodox, and that some of these use the
    Easter date from Western Christian (Protestant and Catholic) tradition,
    and some use Eastern Orthodox Easter. Then there are other Christian
    groups such as Jehovah's Witnesses that do not celebrate Easter at all,
    and there are not doubt many others that I have never heard of that do
    do things somewhat differently.

    2. Simplification. You can't cover /everything/.

    3. Local bias. If you are involved in a particular Church, then that determines the Easter of relevance to you. Many countries will also
    have a strong bias towards one interpretation of Easter - perhaps for
    public holidays, school terms, or other purposes.

    4. Lack of thought or consideration - people don't always think things
    through or consider all implications of things they write. That does
    not make them arrogant or bigoted - it just makes them a normal,
    fallible human.

    5. Lack of relevance. If the code was just some sample C code for
    learning the language, details of what it is actually calculating don't
    matter in the context.

    It might have been better for the OP to use "The Catholic Church Easter"
    rather than just "Easter", but I don't think it is fair to suggest a
    particular arrogance (much less to imply bigotry of some kind as you do
    here) on the part of the OP.

    (I think it is a good thing to take a stand against bigotry when you see
    it, but it is not helpful to go searching for it where it is not present.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joe Pfeiffer@21:1/5 to Lawrence D'Oliveiro on Mon Feb 26 11:20:14 2024
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that Easter
    would never coincide with Passover? Because the sight of Christians celebrating together with Jews was seen as heretical or something ...

    That's an Eastern Orthodox rule, not Western. Last year (western)
    Easter was April 9, while Passover was April 5 through 13 (this year
    they don't overlap).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Joe Pfeiffer@21:1/5 to Lawrence D'Oliveiro on Mon Feb 26 11:24:29 2024
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Sat, 24 Feb 2024 23:57:16 +0100, Janis Papanagnou wrote:

    ... and that there's not a unique definition of Easter.

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for their
    own propaganda purposes.

    While that unquestionably true of Christmas, Easter very clearly comes
    from Passover. It's true that in German-derived languages the name comes
    from a Germanic goddess, and some countries have some traditions taken
    from there as well, but that doesn't change the origin.

    Just like they took a lot of existing pagan deities (e.g. in Celtic lands) and reinvented them as “saints”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to Scott Lurndal on Mon Feb 26 19:54:25 2024
    Scott Lurndal <scott@slp53.sl.home> wrote:

    int foo(const struct tm *now, int hDay);

    I would expect that an enumeration would be superior
    to an 'int' for this purpose.

    Just now getting around to thinking of that to be honest
    Scott (seems you're step ahead of me), but enums are
    great in my thinking, consider:

    enum weekdays { Sun, Mon, Tue, Wed, Thu, Fri, Sat };

    if (Wed > Sun) { ... }

    Nice & easy to read yeah?


    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Mike Sanders on Mon Feb 26 20:06:44 2024
    porkchop@invalid.foo (Mike Sanders) writes:
    Scott Lurndal <scott@slp53.sl.home> wrote:

    int foo(const struct tm *now, int hDay);

    I would expect that an enumeration would be superior
    to an 'int' for this purpose.

    Just now getting around to thinking of that to be honest
    Scott (seems you're step ahead of me), but enums are
    great in my thinking, consider:

    enum weekdays { Sun, Mon, Tue, Wed, Thu, Fri, Sat };

    if (Wed > Sun) { ... }

    Nice & easy to read yeah?

    When you're working with dates, wednesday both preceeds
    and follows sunday; so your if statement is logically
    ambiguous.

    Often, struct tm is useful for representing date/times
    (unless you need year values 12024 or more years before present).

    seconds [0-59]
    minutes [0-59]
    hours [0-23]
    day [1-31]
    month [0-11]
    year [INT_MIN - INT_MAX]
    wday [0-6] /* day of week */
    yday [0-365] /* day of year */
    isdst [-1,0,1] /* DST flag */


    In any case, your 'hday' would have enumerated a
    list of holidays, right? Where ordering wouldn't
    be a prime criteria, rather the usefulness of an
    enumeration would be in readability and maintainabilty
    of the code.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Sanders@21:1/5 to Scott Lurndal on Mon Feb 26 21:18:01 2024
    Scott Lurndal <scott@slp53.sl.home> wrote:

    In any case, your 'hday' would have enumerated a
    list of holidays, right? Where ordering wouldn't
    be a prime criteria, rather the usefulness of an
    enumeration would be in readability and maintainabilty
    of the code.

    Likely something close to (beware word-wrap) the following:

    #define MAXNODES 6000

    int foo(const struct tm *now, this, that, FILE *file) {

    int totalDays = 366;
    int count = 0;

    BLOCK *nodes = (BLOCK *)malloc(MAXNODES * sizeof(BLOCK));
    if (!nodes) return eMsg(errALLOC, 0);

    temp_date = *now;

    if (ops.hly) {
    for (int j = temp_date.tm_mday; j <= totalDays && count < MAXNODES; j++) {
    BLOCK tmp = putHoliday(tmp_date, ENUM_WILL_BE_PLACED_HERE);
    if (tmp) {
    nodes[count] = tmp;
    temp_date = addDays(tmp_date, 1); // so we can see ahead of the curve...
    count++;
    }
    }
    }


    if (count) {
    for (int q = 0; q < count; q++)
    fprintf(file, "%s whatever", node[q].member);
    }

    free(nodes); // etc...
    return 0;

    }

    BLOCK putHoliday(const struct tm *now, ENUM_WILL_BE_PLACED_HERE) {

    // you get the idea i'm guessing

    }

    struct tm addDays(struct tm date, int days) {
    date.tm_mday += days; // add days to the current date
    mktime(&date); // normalize date
    return date;
    }


    --
    :wq
    Mike Sanders

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Joe Pfeiffer on Mon Feb 26 23:20:34 2024
    On Mon, 26 Feb 2024 11:24:29 -0700, Joe Pfeiffer wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for
    their own propaganda purposes.

    While that unquestionably true of Christmas, Easter very clearly comes
    from Passover.

    Easter bunny? Eggs? Both fertility symbols, associated with (northern)
    spring and the beginning of the planting season? And both with origins
    older than Christianity and Judaism combined?

    Somehow I doubt it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Lurndal@21:1/5 to Lawrence D'Oliveiro on Mon Feb 26 23:31:25 2024
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Mon, 26 Feb 2024 11:24:29 -0700, Joe Pfeiffer wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for
    their own propaganda purposes.

    While that unquestionably true of Christmas, Easter very clearly comes
    from Passover.

    Easter bunny? Eggs? Both fertility symbols, associated with (northern)
    spring and the beginning of the planting season? And both with origins
    older than Christianity and Judaism combined?

    Somehow I doubt it.

    March was the first month of the year in Roman times (which is why september
    is derived from the latin for seven). It's likely that there were a
    number of pagen festivals in the northern hemisphere spring associated
    with rebirth (of the year, of the crops, etc).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Scott Lurndal on Tue Feb 27 00:59:59 2024
    On Mon, 26 Feb 2024 20:06:44 GMT, Scott Lurndal wrote:

    porkchop@invalid.foo (Mike Sanders) writes:

    if (Wed > Sun) { ... }

    Nice & easy to read yeah?

    When you're working with dates, wednesday both preceeds and follows
    sunday; so your if statement is logically ambiguous.

    There is a term for that: it’s “modulo arithmetic”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From vallor@21:1/5 to All on Tue Feb 27 01:28:53 2024
    On Mon, 26 Feb 2024 11:45:36 +0100, David Brown <david.brown@hesbynett.no> wrote in <urhq4h$2g5oc$1@dont-email.me>:

    On 25/02/2024 18:39, Lew Pitcher wrote:
    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.

    I agree here.

    I'd also avoid single-letter capital letter variables, and avoid single-letter variables that are easily misread (so don't use "L" or
    "O", big or small). Single-letter variables are fine if their scope is
    small and their meaning is clear - such as "i" for a loop variable, and
    "x" and "y" for coordinates.

    Good names here, together with some comments, would go a long way to
    making it possible to understand your algorithm here. Links to web
    pages for reference are useful (and it's always polite to give your references), but remember that web pages don't last for ever - try to
    make your code stand alone as code, or at least have enough comments to
    cover the information.

    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'd disagree with that one. Initialise your variables when you have something to put in them, and that is often a calculated value.


    Otherwise, it /appears/ to do the job. Good first attempt.

    Some other suggestions:

    Don't use "int" when you mean "bool". That applies to parameters,
    return types, and variables.

    Don't have one function that appears to do two different things. It's
    much better to have "isEaster()" and "isGoodFriday()" functions. Clearly these are heavily related, so have a static helper function that does
    the common calculations.

    Consider making and using several general functions, rather than having
    a single impenetrable function. You might have a "numberOfDaysInYear()" function, and functions for converting (day, month) pairs back and forth
    to the number of days since the first of January. You can have lunar calculations also based on the number of days from a given starting
    point (perhaps using Unix epoch time rather than struct tm). Then you
    can have a "findEaster()" function that returns the date of Easter for a given year as the number of days from the first of January.

    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?)

    Feed the easterg() function to ChatGPT, and it will pretend
    to explain it. (Is it correct? Beats me. But it did
    introduce me to the concept of the "Computus"[*].)

    [*] Described in here: https://en.wikipedia.org/wiki/Date_of_Easter

    --
    -v
    "What did you give up for Lent?" "Religion."

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to vallor on Tue Feb 27 02:25:44 2024
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Joe Pfeiffer on Tue Feb 27 10:08:48 2024
    On 26/02/2024 19:20, Joe Pfeiffer wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that Easter
    would never coincide with Passover? Because the sight of Christians
    celebrating together with Jews was seen as heretical or something ...

    That's an Eastern Orthodox rule, not Western. Last year (western)
    Easter was April 9, while Passover was April 5 through 13 (this year
    they don't overlap).

    Are you sure it is a rule at all?

    In one of the early counsels establishing the "official" doctrine of the
    early Christian (Catholic) church, the date system for holy days was
    defined as independent of the Hebrew calendar. That meant that the
    system for determining the date of Easter was not the same as for the
    Jewish Passover, and they did not have to match up. But it /also/ meant
    that they could, coincidentally, occur at the same time.

    Did the Eastern Orthodox church specifically add this rule afterwards?
    I thought the Eastern Orthodox churches used basically the same
    algorithm as the Western churches, just with a different calender and (I
    think) a slightly different way to define their "lunar" cycles. (I put
    "lunar" in quotation marks, since neither Eastern nor Western "lunar"
    cycles matches exactly with the moon.)

    My knowledge of the details of Eastern Orthodox churches is shaky at
    best, so I could be getting this wrong.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Kuyper@21:1/5 to Lawrence D'Oliveiro on Tue Feb 27 05:02:58 2024
    On 2/26/24 18:20, Lawrence D'Oliveiro wrote:
    On Mon, 26 Feb 2024 11:24:29 -0700, Joe Pfeiffer wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for
    their own propaganda purposes.

    While that unquestionably true of Christmas, Easter very clearly comes
    from Passover.

    Easter bunny? Eggs? Both fertility symbols, associated with (northern)
    spring and the beginning of the planting season? And both with origins
    older than Christianity and Judaism combined?

    Somehow I doubt it.

    He was not talking about Easter customs, he was talking about the
    *definition" of Easter - the date on which it is celebrated, which is
    the very Subject of this [OT] thread. The Last Supper is unambiguously described in the Christian Bible as occurring during the week of
    Passover, which starts on Nissan 15 in the Hebrew calendar. As a result,
    the early Christians, who merely considered themselves a sect of
    Judaism, originally celebrated Easter a few days later, corresponding to
    Jesus' supposed resurrection from the dead.

    By the Council of Nicaea, some Christians had come to believe that the
    Jews were misinterpreting their own rules for the Jewish calendar,
    sometimes starting the month of Nissan on the wrong date. They were
    chafing against the idea that they had to accept Jews as authorities on
    that matter, which is why Council decided otherwise. They were not
    co-opting a pagan date - they were trying to be MORE correct than the
    Jews as to the timing of Passover.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to Lew Pitcher on Tue Feb 27 10:17:56 2024
    On 26/02/2024 18:26, Lew Pitcher wrote:
    On Mon, 26 Feb 2024 11:45:36 +0100, David Brown wrote:

    On 25/02/2024 18:39, Lew Pitcher wrote:
    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
    [snip]
    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'd disagree with that one. Initialise your variables when you have
    something to put in them, and that is often a calculated value.

    I base my suggestion on the OP's source:
    int isEasterOrGoodFriday(const struct tm *now, int checkGoodFriday) {

    int Y = now->tm_year + 1900; // correcting the year
    int a = Y % 19;
    int b = Y / 100;
    int c = Y % 100;
    int d = b / 4;
    int e = b % 4;
    int f = (b + 8) / 25;
    int g = (b - f + 1) / 3;
    int h = (19 * a + b - d - g + 15) % 30;
    int i = c / 4;
    int k = c % 4;
    int L = (32 + 2 * e + 2 * i - h - k) % 7;
    int m = (a + 11 * h + 22 * L) / 451;
    int month = (h + L - 7 * m + 114) / 31;
    int day = ((h + L - 7 * m + 114) % 31) + 1;

    if (checkGoodFriday) {
    [rest of code elided]

    The program code /depends/ on the specific order of
    the declarations: <<Y>> /must/ be declared before <<a>>,
    <<a>> /must/ be declared before <<h>>, etc.

    Yes, because "a" is initialised with an expression using "Y".


    If some good-meaning (or unknowledgable) maintainer decides to
    reorder or consolidate the above declarations, the program
    either fails or gives erroneous results.

    Why would anyone do that? These are initialised variables that depend
    on each other. Re-ordering makes no more sense than re-ordering printf("world\n") before printf("Hello ").


    The OP embedded the /logic/ of the program within the declarations.

    You mean, the variables are declared only when there was something to
    put in them?

    That, to me. is /not/ good programming.

    It has been good programming for many decades in C - it doesn't even
    need C99.


    Hope this helps clarify my earlier remarks.

    If you are trying to say that you think the "correct" way to write C
    code is to declare all your variables without initialisation at the
    start of the function and have a strict separation from the expressions
    and statements of the function, then I know what you are saying. I
    totally disagree with it, but that is a discussion that comes up
    regularly, and I believe we've been through it recently. It would be
    on-topic in c.l.c., which is nice, but I'm not sure we'll cover anything
    new.

    If that's /not/ what you are saying, them I'm afraid I don't yet
    understand your point.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Joe Pfeiffer on Tue Feb 27 13:12:44 2024
    On Mon, 26 Feb 2024 11:20:14 -0700
    Joe Pfeiffer <pfeiffer@cs.nmsu.edu> wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that
    Easter would never coincide with Passover? Because the sight of
    Christians celebrating together with Jews was seen as heretical or something ...

    That's an Eastern Orthodox rule, not Western. Last year (western)
    Easter was April 9, while Passover was April 5 through 13 (this year
    they don't overlap).

    This year Western Easter does not overlap with Passover because of approximately four day difference in definition of official start of
    Spring. When there is a full moon between 21st and 24th of Martch, by
    Western rules it's already Spring, but by Jewish rules it's still
    Winter and does not count.
    It happens approximately 3 times in 19-year cycle. Or, may be, exactly
    3 times, I don't know for sure.
    So, it seems, Western Easter overlaps with Passover in overwhelming
    majority of years - 16 out of 19.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Scott Lurndal on Tue Feb 27 12:50:10 2024
    On 27.02.2024 00:31, Scott Lurndal wrote:

    March was the first month of the year in Roman times (which is why september is derived from the latin for seven). [...]

    Actually true for September, October, November, and December (derived
    from numbers 7, 8, 9, 10 in Latin).

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to David Brown on Tue Feb 27 13:00:55 2024
    On 27.02.2024 10:08, David Brown wrote:
    [...] I
    thought the Eastern Orthodox churches used basically the same algorithm
    as the Western churches, [...]

    That was the impression I got when skimming through the Wikipedia
    articles.[*]

    Janis

    [*] See chapter "Gültigkeit" on https://de.wikipedia.org/wiki/Gau%C3%9Fsche_Osterformel
    which says that (at least the Gauss') calculation applies to Julian
    and Gregorian calendars, and at the end of the next chapter explains
    the parameters for Julian calendar and that it can easily be adjusted
    for the Gregorian by OS_Ost = OS + (X div 100) − (X div 400) − 2.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Michael S@21:1/5 to Michael S on Tue Feb 27 14:36:58 2024
    On Tue, 27 Feb 2024 13:12:44 +0200
    Michael S <already5chosen@yahoo.com> wrote:

    On Mon, 26 Feb 2024 11:20:14 -0700
    Joe Pfeiffer <pfeiffer@cs.nmsu.edu> wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Sat, 24 Feb 2024 21:15:56 -0000 (UTC), Mike Sanders wrote:

    Calculate the date of Easter Sunday or Good Friday:

    Did you know that one of the requirements of the rules was that
    Easter would never coincide with Passover? Because the sight of Christians celebrating together with Jews was seen as heretical or something ...

    That's an Eastern Orthodox rule, not Western. Last year (western)
    Easter was April 9, while Passover was April 5 through 13 (this year
    they don't overlap).

    This year Western Easter does not overlap with Passover because of approximately four day difference in definition of official start of
    Spring. When there is a full moon between 21st and 24th of Martch, by
    Western rules it's already Spring, but by Jewish rules it's still
    Winter and does not count.
    It happens approximately 3 times in 19-year cycle. Or, may be, exactly
    3 times, I don't know for sure.
    So, it seems, Western Easter overlaps with Passover in overwhelming
    majority of years - 16 out of 19.


    P.S.
    Eastern Easter, more properly called Pascha, rarely coincides with
    Passover week, but not by ideological design, as insinuated by Lawrence D'Oliveiro. It happens because, due to accumulated errors, Julian
    Spring starts ~15 days after solar equinox while Jewish Spring starts
    ~5 days after solar equinox*.

    Despite that, sometimes Pascha does happen during Passover. The next
    such time will be in 2028, where Pascha will be in the last day of
    Passover. I would think that few centuries ago it happened more often
    and 1000 years ago it happened most of the time.

    * - it's more complicated, really, but for practical purposes of
    calculation of Passover day the above holds.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to James Kuyper on Tue Feb 27 22:50:16 2024
    On Tue, 27 Feb 2024 05:02:58 -0500, James Kuyper wrote:

    On 2/26/24 18:20, Lawrence D'Oliveiro wrote:

    On Mon, 26 Feb 2024 11:24:29 -0700, Joe Pfeiffer wrote:

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    Easter, Christmas ... both ancient pagan festivals co-opted by the
    Christians and given an invented meaning under their ideology, for
    their own propaganda purposes.

    While that unquestionably true of Christmas, Easter very clearly comes
    from Passover.

    Easter bunny? Eggs? Both fertility symbols, associated with (northern)
    spring and the beginning of the planting season? And both with origins
    older than Christianity and Judaism combined?

    Somehow I doubt it.

    He was not talking about Easter customs, he was talking about the *definition" of Easter ...

    In that case, that argument would also apply to the “definition” of Christmas. So that what was “unquestionably true of Christmas” (as stated above) must be the date. Which it is not.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to James Kuyper on Tue Feb 27 22:48:13 2024
    On Tue, 27 Feb 2024 05:02:58 -0500, James Kuyper wrote:

    They were not co-opting a pagan date - they were trying to be MORE
    correct than the Jews as to the timing of Passover.

    Religion is a matter of belief, not fact. Trying to be “more correct” than official religious authorities has a name: “heresy”.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Kuyper@21:1/5 to Lawrence D'Oliveiro on Tue Feb 27 19:06:22 2024
    On 2/27/24 17:48, Lawrence D'Oliveiro wrote:
    On Tue, 27 Feb 2024 05:02:58 -0500, James Kuyper wrote:

    They were not co-opting a pagan date - they were trying to be MORE
    correct than the Jews as to the timing of Passover.

    Religion is a matter of belief, not fact. Trying to be “more correct” than
    official religious authorities has a name: “heresy”.

    Actually, no. The Christians had fully separated from Judaism by that
    time - they no longer accepted the authority of Jewish religious
    authorities. That is why it was considered so annoying to many
    Christians that they had to go to Jewish religious authorities to
    determine the correct timing for a Christian religious celebration. The
    Council of Nicaea was where they officially decided that they didn't
    need to do that anymore.

    Whether or not it's heresy is also irrelevant to the point under debate: whether the date of Easter was co-opted from a pagan religion. It wasn't
    (you might be thinking of Christmas, which was so co-opted).

    Incidentally, when the rules for determining how a calendar system
    should work have been formalized, whether or not those rules have been
    followed becomes a matter of fact, not a matter of belief or opinion.
    Whether that calendar system should be used, whether the holy days of a
    given religion should be celebrated according to that calendar are all
    matters of opinion. Whether those rules had been formalized and followed
    is not. I personally have not delved into the historical evidence deeply
    enough to have an opinion on that issue - precisely because that issue
    is irrelevant to the point under discussion. The timing of the Easter celebration had nothing to do with any pagan religion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to James Kuyper on Wed Feb 28 00:11:10 2024
    On Tue, 27 Feb 2024 19:06:22 -0500, James Kuyper wrote:

    On 2/27/24 17:48, Lawrence D'Oliveiro wrote:

    On Tue, 27 Feb 2024 05:02:58 -0500, James Kuyper wrote:

    They were not co-opting a pagan date - they were trying to be MORE
    correct than the Jews as to the timing of Passover.

    Religion is a matter of belief, not fact. Trying to be “more correct”
    than official religious authorities has a name: “heresy”.

    Actually, no. The Christians had fully separated from Judaism by that
    time - they no longer accepted the authority of Jewish religious
    authorities.

    Or rather, the ones that still did were the ones considered “heretics”.

    whether the date of Easter was co-opted from a pagan religion. It wasn't

    Nobody said it was.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Kuyper@21:1/5 to Lawrence D'Oliveiro on Tue Feb 27 19:41:36 2024
    On 2/27/24 17:50, Lawrence D'Oliveiro wrote:
    On Tue, 27 Feb 2024 05:02:58 -0500, James Kuyper wrote:
    ...
    He was not talking about Easter customs, he was talking about the
    *definition" of Easter ...

    In that case, that argument would also apply to the “definition” of Christmas. So that what was “unquestionably true of Christmas” (as stated above) must be the date. Which it is not.

    No, the date of Christmas was co-opted from a pagan Roman celebration.
    The date of Easter was based upon Jewish traditions for Passover. With modifications, to be sure - but those modifications were not co-opted
    from pagan religions, they were due to a disagreement about the details
    of the rules for the Hebrew calendar.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Kuyper@21:1/5 to Lawrence D'Oliveiro on Tue Feb 27 19:24:05 2024
    On 2/27/24 19:11, Lawrence D'Oliveiro wrote:
    On Tue, 27 Feb 2024 19:06:22 -0500, James Kuyper wrote:
    ...
    Actually, no. The Christians had fully separated from Judaism by that
    time - they no longer accepted the authority of Jewish religious
    authorities.

    Or rather, the ones that still did were the ones considered “heretics”.

    Each side considered the other heretics. Heresy is a normally a two-way accusation.

    whether the date of Easter was co-opted from a pagan religion. It wasn't

    You were the one who interrupted a discussion of the date of Easter by
    claiming that Easter had been co-opted from pagan celebrations. Many of
    the customs followed during Easter were co-opted, but not the date,
    which rendered your comment a non-sequitur.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Lew Pitcher on Wed Feb 28 01:54:32 2024
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David Brown@21:1/5 to James Kuyper on Wed Feb 28 13:13:34 2024
    On 28/02/2024 01:41, James Kuyper wrote:
    On 2/27/24 17:50, Lawrence D'Oliveiro wrote:
    On Tue, 27 Feb 2024 05:02:58 -0500, James Kuyper wrote:
    ...
    He was not talking about Easter customs, he was talking about the
    *definition" of Easter ...

    In that case, that argument would also apply to the “definition” of
    Christmas. So that what was “unquestionably true of Christmas” (as stated
    above) must be the date. Which it is not.

    No, the date of Christmas was co-opted from a pagan Roman celebration.
    The date of Easter was based upon Jewish traditions for Passover. With modifications, to be sure - but those modifications were not co-opted
    from pagan religions, they were due to a disagreement about the details
    of the rules for the Hebrew calendar.

    Exactly.

    There is clear Biblical justification for saying that the key Christian religious events connected with Easter (centring on Jesus' claimed death
    and resurrection) have a date directly related to the Jewish Passover at
    that time. There is no Biblical justification for suggesting that the
    the religious events of Christmas (the birth of Jesus) occurred in the
    middle of winter or at any other particular time. (And there is no
    evidence for any of this from non-Biblical sources, including, AFAIK,
    other early Christian writings.) The date set for Christmas is thus
    completely arbitrary from the religious viewpoint - it was picked to
    co-opt existing mid-winter festivals.

    You could go further back if you like - you could reasonably argue that
    the date for the Jewish Passover was co-opted from older Canaanite
    spring festivals. Basically, every culture and religion has had a
    variety of festivals, and mid-winter, spring, mid-summer and autumn
    (harvest time) are peaks for these. And every culture and religion that
    has spread to other areas has either merged their festivals, co-opted
    them, or overridden them, adapting old traditions and inventing new ones.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to James Kuyper on Wed Feb 28 20:47:32 2024
    On Tue, 27 Feb 2024 19:24:05 -0500, James Kuyper wrote:

    You were the one who interrupted a discussion of the date of Easter by claiming that Easter had been co-opted from pagan celebrations. Many of
    the customs followed during Easter were co-opted, but not the date,
    which rendered your comment a non-sequitur.

    Remember, you were the one who said that “the point under debate” was “whether the date of Easter was co-opted from a pagan religion”. Not me.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Kaz Kylheku@21:1/5 to Keith Thompson on Wed Feb 28 22:20:03 2024
    On 2024-02-28, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    because it has nothing to do with C. (C code that calculates the date
    of Easter is topical here; debates about holidays being co-opted from
    pagan religions are not.)

    Easter is topical here to the extent that this is a sort island,
    which is rumoured to be inhabited by cannibals.

    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Kuyper@21:1/5 to Lawrence D'Oliveiro on Thu Feb 29 13:21:03 2024
    On 2/28/24 15:47, Lawrence D'Oliveiro wrote:
    On Tue, 27 Feb 2024 19:24:05 -0500, James Kuyper wrote:

    You were the one who interrupted a discussion of the date of Easter by
    claiming that Easter had been co-opted from pagan celebrations. Many of
    the customs followed during Easter were co-opted, but not the date,
    which rendered your comment a non-sequitur.

    Remember, you were the one who said that “the point under debate” was “whether the date of Easter was co-opted from a pagan religion”. Not me.

    You're right. That was a misstatement. The point under debate was the
    timing of Easter. You're assertion that Easter had been co-opted from
    pagan religions would have been relevant if you'd been claiming that the
    date of Easter was one of the things that had been co-opted. It would
    have been a false claim, but a relevant one. A person could be excused
    for thinking that you'd intended to make a relevant comment. However,
    you never made that particular assertion, rendering the comment you did
    make a non-sequitur. I apologize for mis-characterizing what was wrong
    with your comment.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to vallor on Sun Mar 3 10:03:42 2024
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Ben Bacarisse on Sun Mar 3 10:23:03 2024
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Tim Rentsch@21:1/5 to Lew Pitcher on Sun Mar 3 11:05:26 2024
    Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:

    [minor editing]

    On 25/02/2024 18:39, Lew Pitcher wrote:

    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

    My suggestions, with respect to your program, would be to
    [...]
    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.

    Minor comment: normally I am used to the term "logic" to mean
    how control structures are used, not simply the order of
    otherwise sequential program elements. However I think I
    understand what you mean so let's ignore that question.

    I base my suggestion on the OP's source:
    int isEasterOrGoodFriday(const struct tm *now, int checkGoodFriday) {

    int Y = now->tm_year + 1900; // correcting the year
    int a = Y % 19;
    int b = Y / 100;
    int c = Y % 100;
    int d = b / 4;
    int e = b % 4;
    int f = (b + 8) / 25;
    int g = (b - f + 1) / 3;
    int h = (19 * a + b - d - g + 15) % 30;
    int i = c / 4;
    int k = c % 4;
    int L = (32 + 2 * e + 2 * i - h - k) % 7;
    int m = (a + 11 * h + 22 * L) / 451;
    int month = (h + L - 7 * m + 114) / 31;
    int day = ((h + L - 7 * m + 114) % 31) + 1;

    if (checkGoodFriday) {
    [rest of code elided]

    The program code /depends/ on the specific order of
    the declarations: <<Y>> /must/ be declared before <<a>>,
    <<a>> /must/ be declared before <<h>>, etc.

    If some good-meaning (or unknowledgable) maintainer decides to
    reorder or consolidate the above declarations, the program
    either fails or gives erroneous results.

    If variables are declared separately, without any initializers,
    and all assignments are done after all the declarations, then the
    assignment statements can be arbitrarily reordered and still get
    a compilable program. If varibles are all declared with an
    initializing expression, as above, then any improper reordering
    gives a compilation error, due to a variable being undeclared.
    It seems to be that separating the declarations and the initial
    assignments is more error prone than keeping them together.

    The OP embedded the /logic/ of the program within the declarations.
    That, to me, is /not/ good programming.

    I don't understand why you think that. Can you explain further?

    Hope this helps clarify my earlier remarks.

    It does help clarify the what. I still don't yet understand the
    why.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)