• Keine Ergebnisse gefunden

resul.t=BTD (a.l"'g) result

Im Dokument RESEARCI-I INC. (Seite 145-155)

result

arg

Decimal ASCII result (right-justified, blank-filled) Integer argument

Call from CAL:

CALLV BTD%,81

Entry:

(81)

Exit:

(Sl) Example:

Integer value

Decimal ASCII result (right-justified, blank-filled)

Call from FORTRAN:

pesu 1. t=DTB (arg,e.l"'.l"'code)

.l"'esu"l.t a.l"'g e

rTC

ode

Call from CAL:

Integer value

Decimal ASCII (left-justified, zero-filled)

o

if conversion successful, -1 if error

I

CALLV DTB%,Sl

Entry:

(81)

Exit:

(81)

(SO)

Decimal ASCII (left-justified, zero-filled) Integer value

Error code 0 if conversion successful -1 if error

PSEUDO VECTORIZATION ROUTINES

Pseudo vectorization simulates vectorized math routines. See the PVEC macro in the Macros and Opdefs Reference Manual, CRI publication SR-0012.

MISCELLANEOUS MATH ROUTINES

The math routines can be divided into the following types.

• Absolute value ABS

CABS DABS lABS

• Complex conjugate CONJG

• Double-precision product of real arguments DPROD

• Imaginary portion of complex number A I MAG

• Modulo arithmetic AMOD

DMOD MOD

Nearest integer NINT

IDNINT

Nearest whole number ANINT

DNINT

positive difference DDIM

DIM IDIM

Sign transfer DSIGN

ISIGN SIGN

SR-OOI4 3-28 I

• Truncation AINT DINT

• Type conversion

CHAR CMPLX

DBLE FLOAT INT

ICHAR REAL

Table 3-14 contains the miscellaneous math routines.

Table 3-14. Miscellaneous math routines

General Entry Call Argument Type Result

purpose Name Seq. Type

Code 1 2

Real absolute ABS SA R R

value

Find the AIMAG SA C R

imaginary portion of a complex number

Truncate AINT SA R R

to integral value

Real modulo AMOD SA R R R

arithmetic

y=xl-x2 [xI/x2] Xl x2 Y

Calculates ANI NT SA R R

nearest whole number

y=lx+.5j i f x>O

y= [;c.-. SJ if x<O

Restrictions

[x[,[yl<oo

Ixl<2 46

IXI[<247 O< lx2[<2 47

Ix[<2 46

Table 3-14. Miscellaneous math routines (continued) General Entry Call Argument Type Result

Purpose Name Seq. Type Restrictions

Code 1 2

Complex CABS SA C R Ixl,lyl<oo

absolute CABS%; svb x 2+y2< 00

value %CABS VA where complex

% CABS % Wb argument

z=x+iy

Integer to CHAR I CH

character conversion

Convert two CMPLX SA R R C

reals to a complex

Complex CONJG SA C C Ixl,lyl<oo

conjugate where complex

argument z=x+iy

Determine DABS SA D D Ix I<co

double-precision absolute value

Convert DBLE SA R D

real to double-precision

Double- DDIM SA D D D Ixl,lyl<oo

precision DDIM% SVb

positive real %DDIM VA difference %DDIM% Wb MAX (0 ,x-y)

SR-0014 3-30 I

Table 3-14. Miscellaneous math routines (continued) General Entry Call Argument Type Result

Purpose Name Seq. Type Restrictions

Code 1 2

positive real DIM SA R R R Ixl,lyl<co

difference MAX (O,x-y)

I

Truncate DINT SA D D Ixl<2 95

double- DINT% SVb

precision %DINT VA

numbers, %DINT% Wb

y=[x]

fraction last no rounding

Double- OMOD SA D D 0 IXll<295

precision OOOD% SVb O<IX21<295

modulo %DMOD VA Xl x2 Y

arithmetic %DMOD% Wb y=xl-x2 Ixl /x2]

Calculates DNINT SA D D Ixl<2 95

nearest DNINT% SVb

integer; %DNINT VA

defined as %DNINT% VVb

f.1c+. SJ if x>O

1Jc-.5J if x<O

Double- DPROD SA R R D I x I , I y I <00 precision

product of two real arguments

Table 3-14. Miscellaneous math routines (continued)

General Entry Call Argument Type Result

Purpose Name Seq. Type Restrictions

Code 1 2

Transfers DSIGN SA D D D I xII, I x21 < 00

sign from (to (from

one double- which which

precision sign is sign is

number to trans-

trans-another ferred) ferred)

defined as y=lxll if

x~O

y=/xl' if x2<O

Convert FLOAT SA I R /xl<246

integer to real

Integer lABS SA I I /xl< CIO

absolute value

Character I CHAR CH I

to integer conversion

Positive IDIM SA I I I /xl,ly/<oo

integer difference MAX (O,x-y)

SR-OOI4 3-32 I

Table 3-14. Miscellaneous math routines (continued) General Entry Call Argument Type Result

purpose Name Seq. Type Restrictions

Code 1 2

Nearest IDNINT SA D I Ixl<246

integer to a IDNINT% SVb

double- %IDNINT VA

precision %IDNINT% VVb number;

defined as Lx+.5J if x>O Lx-.5J if x<O

Truncate to INT SA R I Ixl<2 46

integral value

Transfer ISIGN SA I I I I xII, 'x2' <00

sign from (to (from

one integer which which

to another sign is sign is

defined as trans-

trans-y=lxll if ferred) ferred)

I

x2~O y=-Ixl/ if

x2<O

Perform MOD SA I I I 1Xl/<263

64-bit modulo MOD% SVb xl x2 y O</x21<2 63

arithmetic MODSS% SVb

(Sl-on two

remain-integer der S2

scalars

quot-y=xl-x 2 [Xl/x2] ient)

Table 3-14. Miscellaneous math routines (continued)

General Entry Call Argument Type Result

Purpose Name Seq. Type Restrictions

Code I 2

Perform %MOD% Wb I I I 1Xll<263

64-bit modulo MODW% Wb xl x2 y O< lx2/<2 63

arithmetic

(Vl-on two

rernain-integer der

V2-vectors

quot-y:;lx l-x2 ient)

(xl/x2) I

Perform MODSV% I I I 1XI,<263

64-bit xl x2 i - y O<lx21<263

modulo (divi- (divi-

(Vl-arithmetic dend) sor)

remain-on integer (Sl) (V2) der

V2-scalar and

quot-integer ient)

vector

Perform MODVS% I I I 1Xll<263

64-bit (divi- (divi- (VI- O<lx2,<263

modulo dend) sor)

remain-arithmetic (VI) (S2) der

S2-on integer

quot-vector and ient)

integer scalar

Calculate NINT SA I Ix/<246

nearest integer y:; Lx+.5J

if x>O y= Lx-. SJ if x<O

Return real REAL SA C R

portion of a complex number

SR-OOl4 3-34 I

Table 3-14. Miscellaneous math routines (continued)

General Entry Call Argument Type Result

Purpose Name Seq. Type Restrictions

Code 1 2

Transfer SIGN SA R R R IXll,I}<;:21<co

sign from (to (from

one real which which

number sign is sign is

to another; trans-

trans-defined as ferred) ferred)

y=lxll if

x~O

y= IXII if x2<O

Examples:

Call from CAL:

CALL FLOAT, (al"g) Entry:

al"gl Address of integer argument E}<;:it:

(81) Real result Call from FORTRAN:

l"eaL=FLOAT(integer)

Y'ea~ Real result Integer result

RANDOM NUMBER ROUTINES

Table 3-15. Random number routines

Call Result

Purpose Entry Seq. Argument Type Type

Name Code

Generates RANF SA No arguments R

random RANF% SVa required (VL) numbers %RANF VA assumed correct

%RANF% VVa for vectorized versions

Returns RANGET SA I (optional) I

current RANGET% SVa seed of

random number generator

Sets RANSET SA I (optional) I

random RANSET% SVa

seed

NOTE

When the seed of the random number generator is reset, RANSET does not store the supplied argument as the first value in the buffer of the random number seeds.

SR-0014 3-36 I

Examples:

RANF

Call from CAL:

CALL RANF CALLV RANF%

CALL %RANF CALLV %RANF%

Call from FORTRAN:

I

random=RAHF( )

DO 10 1=1,10

10 RANDOM (I) "'RANF ( )

RANGET

Call from CAL:

CALL RANGET CALLV RANGET%

Call from FORTRAN:

CALL

RANGET(iseed)

Im Dokument RESEARCI-I INC. (Seite 145-155)