• Keine Ergebnisse gefunden

FORMAT(I,'POSITIVE DIFFERENCE' ,1,' EQUALS' ,1) STOP

These routines are available to users of both the COS and UNICOS operating systems

2 FORMAT(I,'POSITIVE DIFFERENCE' ,1,' EQUALS' ,1) STOP

END

The preceding program gives the following output.

IMPLEMENTATION

77 POSITIVE DIFFERENCE 10 EQUALS 67 10 POSITIVE DIFFERENCE 77 EQUALS 0

These routines are available to users of both the COS and UNICOS operating systems.

SR-0113 2-27 C

DPROD(3M)

NAME

DPROD - Computes double-precision product of two real numbers SYNOPSIS

d=DPROD(real,real) DESCRIPTION

DPROD(3M)

This double-precision function evaluates

y=x

1

*

X 2. The argument range is

I x

1

I , I x

21 < inf. DPROD is an in-line code function.

EXAMPLE

PROGRAM OOUBT REALX,Y

OOUBLE PRECISION Z X=5.0

Y=6.0

Z=DPROD(X,Y) PRINT *,Z STOP

END

The preceding program gives Z to be the double-precision number 30.0 (or in Fortran, 30.DO).

IMPLEMENTATION

This routine is available to users of both the COS and UNICOS operating systems.

SR-0113 2-28 C

EQV(3M) EQV(3M)

NAME

EQV - Computes the logical equivalence SYNOPSIS

I=EQV(logical,logical) b=EQV(arg,arg) DESCRIPTION

arg Argument of type integer, real, or Boolean

When given two arguments of type logical, EQV computes a logical equivalence and returns a logical result. When given two arguments of type integer, real, or Boolean, EQV computes a bit-wise logical equivalence and returns a Boolean result. The truth tables below show both the logical equivalence and bit-wise logical equivalence.

The following section of Fortran code shows the EQV function used with two arguments of type logical.

LOGICAL Ll, L2, L3

EQV(3M)

IMPLEMENTATION

111111111010111

I3

These routines are available to users of both the COS and UNICOS operating systems.

SR-0113 2-30

EQV(3M)

c

EXP(3M)

NAME

EXP, DEXP, CEXP - Computes exponential function (Cray Fortran intrinsic function) SYNOPSIS

r=EXP(real) d=DEXP(double) z=CEXP(complex) DESCRIPTION

EXP(3M)

EXP (generic name) evaluates

y=e

x with real, double-precision, and complex arguments. The argument ranges are as follows:

For EXP:

For DEXP:

I x I

<213

*

In(2) For CEXP:

IMPLEMENTATION

These routines are available to users of both the COS and UNICOS operating systems.

SR-Ol13 2-31 C

INDEX(3F) INDBX(3F)

NAME

INDEX - Determines index location of a character substring within a string (eray Fortran intrinsic func-tion)

The preceding program returns the index number of the substring SUPERCOMPUTER as 1= 11.

PROGRAM INDEX2

The preceding program returns the index number of the substring CRAY-l as 1=1.

IMPLEMENTATION

This routine is available to users of both the COS and UNICOS operating systems.

SR-OI13 2-32 C

INT(3M) INT(3M)

NAME

INT, IFIX, IDINT - Converts to type integer (Cray Fortran intrinsic function) SYNOPSIS

i=INT(argl) i=IFIX(real) i=IFIX(boolean) i=IDINT(double) DESCRIPTION

argl Argument of type integer, complex, real, or Boolean

These type integer functions (all are in-line Fortran code) convert specified types to type integer by truncating toward 0 (the fraction is lost). INT is the generic name.

The ranges for INT are as follows: for complex and real arguments,

I

x r

I

< 246; for 24-bit integer argu-ments,

I

x 1<223; and for integer and Boolean arguments

I

x 1<263. Type conversion routines assign the appropriate type to Boolean arguments without shifting or manipulating the bit patterns they represent.

The range for IFIX real and Boolean arguments is

I x

r

I

< 246,

The range for IDINT arguments is

I x

r

I

< 263.

IMPLEMENTATION

These routines are available to users of both the COS and UNICOS operating systems.

SR-0113 2-33

C

INT24(3M) 1NT24(3M)

NAME

INT24, LINT - Converts 64-bit integer to 24-bit integer and vice versa (Cray Fortran intrinsic function) SYNOPSIS

i24=INT24(integer) i24=INT24(boolean) i24=LINT(integer) DESCRIPTION

INT24 and LINT (type integer) are inverse functions. Both functions are CRI extensions to the ANSI standard, and both are in-line code.

INT24 converts an integer argument into a 24-bit integer. LINT converts a 24-bit integer back into an integer type. The range for all arguments is

I

x

I

< 223 i24 represents a 24-bit integer result.

IMPLEMENTATION

These routines are available to users of both the COS and UNICOS operating systems.

SR-Ol13 2-34 C

LEADZ(3M) LEADZ(3M)

NAME

LEADZ - Counts the number of leading 0 bits (Cray Fortran intrinsic function) SYNOPSIS

i=LEADZ(arg) DESCRIPTION

NOTES

arg Argument of type integer, real, logical, or Boolean

When given an argument of type integer, real, logical, or Boolean, LEADZ counts the number of lead-ing 0 bits in the 64-bit representation of the argument.

The bit representation of the logical data type is not consistent among Cray machines. See the follow-ing manuals for further details: Fortran (CFf) Reference Manual, publication SR-0009; CRAY-2 Fortran (CFf2) Reference Manual, publication SR-2007; CFf77 Reference Manual, publication SR-0018.

LEADZ(O) is equal to 64.

EXAMPLES

The following section of Fortran code shows the LEADZ function used with an argument of type integer. The bit pattern of the argument and the value of the result are also shown below. For clarity, a 16-bit word is used instead of the actual 64-bit word.

INTEGER Il, 12 ... 12

=

LEADZ(Il)

101010101011111010 I I 1 0 0 1 1 0 1

Il

The LEADZ function returns the value 5 to the integer variable 12.

IMPLEMENTATION

These routines are available to users of both the COS and UNICOS operating systems.

SR-0113 2-35 C

LEN(3F)

NAME

LEN - Determines the length of a character string (Cray Fortran intrinsic function) SYNOPSIS

i=LEN(string) DESCRIPTION

LEN(3F)

The integer function LEN takes Fortran character string arguments and returns an integer length. string can be any valid Fortran character string. LEN is an in-line code function.

EXAMPLE

PROGRAMLENTEST

1=LENCI..·+ .... 1. ... + .... 2 .... + .... 3 .... + .. ') PRINT *,1

STOP

END

The preceding program returns the length of the character string; 1=37.

IMPLEMENTATION

This routine is available to users of both the COS and UNICOS operating systems.

SR-0113 2-36 C

LGE(3F)

NAME

LGE, LGT, LLE, LLT - Compares strings lexically (Cray Fortran intrinsic function) SYNOPSIS

I=LGE(stringl.string2) I=LGT(stringl.string2) I=LLE(stringl.string2) I=LL T(string].string2) DESCRIPTION

LGE(3F)

Each of the these type logical functions takes two character string arguments and return a logical value.

string] and string2 are compared according to the ASCII collating sequence, and the resulting true or false value is returned. Arguments can be any valid character string. If the strings are of different lengths, the function treats the shorter string as though it were blank-filled on the right to the length of the longer string.

The defining equation for each function is as follows:

For LG E, logic

= a

1 ~a 2.

For LGT, logic

=

a l>a 2.

For LLE, logic

=

a 1 Sa 2.

For LLT, logic = a 1<a2 IMPLEMENTATION

These routines are available to users of both the COS and UNICOS operating systems.

SR-0113 2-37

C

MOD(3M) MOD(3M)

NAMB