Deutsch   English   Français   Italiano  
<vddlik$254hd$12@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.os.linux.advocacy,comp.os.linux.misc
Subject: Re: Can't Avoid That Shit Rust - Even On Gentoo
Date: Mon, 30 Sep 2024 07:56:04 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <vddlik$254hd$12@dont-email.me>
References: <pan$96411$d204da43$cc34bb91$1fe98651@linux.rocks>
	<5mqdnZuGq4lgwm_7nZ2dnZfqnPSdnZ2d@earthlink.com>
	<9tDIO.25203$afc4.21891@fx42.iad> <llgvjcF5rlhU3@mid.individual.net>
	<59JIO.96321$WtV9.10707@fx10.iad> <vd8bou$15h6g$2@dont-email.me>
	<18udnd3mEtEGfGX7nZ2dnZfqnPGdnZ2d@earthlink.com>
	<vdap5d$1kp35$4@dont-email.me>
	<fcKcnSXE3MsnqWf7nZ2dnZfqnPudnZ2d@earthlink.com>
	<D0rKO.165127$EEm7.5633@fx16.iad> <vddevg$24fps$4@dont-email.me>
	<llv1scFa6uvU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 30 Sep 2024 09:56:05 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a1a02b051aaecb67c07f3c0a04f3a680";
	logging-data="2265645"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19puX8mUPHpbqV1026NAheR"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:ErYHGVPn59OLswsuRNZXUjg4VTc=
Bytes: 2775

On 30 Sep 2024 07:21:49 GMT, rbowman wrote:

> On Mon, 30 Sep 2024 06:03:29 -0000 (UTC), Lawrence D'Oliveiro wrote:
> 
>> Fun fact: I was reworking an old perpetual-calendar program I first
>> wrote back in 1980, to use Fortran 90, a few months ago. And I found a
>> bug in my algorithm that never showed up in any years from the 20th
>> century, but did manifest itself in the 21st century.
> 
> Y2K rides again...

No, it wasn’t that. I had a full four digits for the year number (even 
back then, I had this hazy premonition ...). The bug actually manifested 
itself from 2004 onwards.

Here’s the patch that fixed the Fortran-90 version:

    diff --git a/calend.f90 b/calend.f90
    index e172fd5..dcbfdc3 100644
    --- a/calend.f90
    +++ b/calend.f90
    @@ -48,14 +48,12 @@ contains
                 idx = idx + 1
                 res = mod(yr, divs(idx))
                 yr = yr / divs(idx)
    -            if (res == 0) then
    +            if (flip_leap .and. res == 0) then
    +                leap = .not. leap
                     rem = rem - l
                 else
                     flip_leap = .false.
                 end if
    -            if (flip_leap) then
    -                leap = .not. leap
    -            end if
                 if (yr == 0) &
                     exit
                 rem = rem + yr * l