Translating Fortran To A Human Readable Language

Answer to yesterday’s riddle. What is the magic number 1196575042?

CALL GBYTE(Z,I4,(K+0)*8,4*8)
CALL GBYTE(Z,I1,(K+7)*8,1*8)
IF(I4.EQ.1196575042.AND.(I1.EQ.1.OR.I1.EQ.2)) THEN
   IF (I1.EQ.1) CALL GBYTE(Z,KG,(K+4)*8,3*8)
   IF (I1.EQ.2) CALL GBYTE(Z,KG,(K+12)*8,4*8)

The C equivalent is :

if ( !strncmp(Z, "GRIB", 4) )
{
   if (Z[7] == 1) strncpy(KG, &Z[4], 3);
   else if (Z[7] == 2) strncpy(KG, &Z[12], 4);
}

About Tony Heller

Just having fun
This entry was posted in Uncategorized. Bookmark the permalink.

5 Responses to Translating Fortran To A Human Readable Language

  1. K says:

    Fortran RULZ.

  2. Paul H says:

    Still Double Dutch to me.

  3. PhilW says:

    C is not that readable either is it – try COBOL 😉

Leave a Reply

Your email address will not be published. Required fields are marked *