Re: Can't Avoid That Shit Rust - Even On Gentoo

Liste des GroupesRevenir à col advocacy 
Sujet : Re: Can't Avoid That Shit Rust - Even On Gentoo
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.advocacy comp.os.linux.misc
Date : 30. Sep 2024, 08:56:04
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vddlik$254hd$12@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12
User-Agent : Pan/0.160 (Toresk; )
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

Date Sujet#  Auteur
4 Jul 25 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal