pxfucompare

Date:

10-20-2011

NAME

PXFUCOMPARE - Compares unsigned integers

SYNOPSIS

INTEGER i1, i2, icmpr, idiff
CALL PXFUCOMPARE(i1, i2, icmpr, idfiff)

IMPLEMENTATION

Cray Linux Environment (CLE)

STANDARDS

IEEE Std 1003.9-1992 standard interface for FORTRAN 77

DESCRIPTION

The PXFUCOMPARE routine performs comparisons of C unsigned integers returned by some IEEE FORTRAN 77 routines.

All arguments must be of default kind unless documented otherwise. Default kind is KIND=4 for integer, real, complex, and logical arguments.

The following is a list of arguments for this routine:

i1

An input integer variable for a C unsigned integer.

i2

An input integer variable for a C unsigned integer.

icmpr

An output integer variable that, on return from the routine, contains one of these values:

  • -1 If i1 < i2

  • 0 If i1 = i2

  • 1 If i1 > i2

All of the comparisons are made using C unsigned integer comparisons.

idiff

An output integer variable that on return from the routine contains the absolute value of the difference of i1 and i2. Since the values are C unsigned integers and FORTRAN 77 does not directly support unsigned integers the value may be negative, which indicates the value is beyond the maximum positive value of a FORTRAN 77 integer.

EXAMPLES

In this example, the program calls PXFTIMES(3F) to return the process time information and then uses PXFUCOMPARE to determine if the system time was greater than 1000000000 clock ticks.

program testpxf
integer itime, jtms, ierror, stime, icmpr, idiff

CALL PXFSTRUCTCREATE('tms',jtms,ierror)
if (ierror .ne. 0) then
  print *,'FAILED: PXFSTRUCTCREATE call with error = ',ierror
else
  call PXFTIMES(jtms,itime,ierror)
  if (ierror .ne. 0) then
     print *,'FAILED: PXFTIMES call with error = ',ierror
  else
     call PXFINTGET(jtms,'tms_stime',stime,ierror)
     if (ierror .ne. 0) then
        print *,'FAILED: PXFINTGET call for tms_stime with error = ',ierror
     else
        CALL PXFUCOMPARE(stime,1000000000,icmpr,idiff)
        if (icmpr .eq. 1) then
          print *,'System time longer than 1000000000 clock ticks.'
        else
          print *,'System time less than or equal to 1000000000 clock ticks.'
        endif
     endif
  endif
endif
end

SEE ALSO

PXFTIMES(3F)