HP3000-L Archives

November 1997, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Reply To:
Date:
Thu, 13 Nov 1997 09:56:03 PST8
Content-Type:
text/plain
Parts/Attachments:
text/plain (60 lines)
I wholeheartedly agree with Wirt!!

Here is a FORTRAN code bit that performs the same calculation:

       leapyear = (mod(year,4) .eq. 0 .AND. mod(year,100) .ne. 0)
      *    .OR.   (mod(year,400) .eq. 0)

Regards

Paul Christidis


______________________________ Reply Separator _________________________________
Subject: Re: Y2K: Leap Year Or Not?
Author:  [log in to unmask] at CCGATE
Date:    11/13/97 05:19


I have always contended that there are no fundamental differences in the
standard 3GL coding languages that are derived from FORTRAN: C, BASIC,
PASCAL, SPL, etc. Indeed, if I were to describe these several languages, I
would say that BASIC is FORTRAN made pretty (and self-checking and
self-tracing) -- and C is FORTRAN made as ugly as possible (and
non-self-checking and non-self-tracing).

To that end, Friedrich Harasleben contributes this bit of C code:

> /* == FUNKTIONEN ======================================== */
>  int sjahr(int nJahr)
>  {
>     int nRest = 0;
>
>     if ((nRest =  nJahr % 4 ) != 0) {
>          return( FALSE );
>     }
>     else {
>          if (( nRest = nJahr % 100 ) == 0) {
>               if (( nRest = nJahr % 400 ) == 0) {
>                    return( TRUE );
>               }
>               else {
>                    return( FALSE );
>               }
>          }
>          else {
>               return( TRUE );
>          }
>     }
>  }
>

while this bit of BASIC code does the same thing:

 1020 I$="non-leap"
 1030 IF Y0 MOD 4=0 THEN I$="leap"
 1040 IF Y0 MOD 100=0 THEN I$="non-leap"
 1050 IF Y0 MOD 400=0 THEN I$="leap"

Wirt Atmar

ATOM RSS1 RSS2