24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Expressions<br />

Example:<br />

(123,0)<br />

(-753,12.3)*2<br />

-(12,-12.4)-(1.0,.2)<br />

A double precision complex constant expression is an arithmetic constant expression in which at least one<br />

constant or symbolic constant is of type COMPLEX*16 and all other constants or symbolic constants are of<br />

type COMPLEX*16, DOUBLE PRECISION, REAL or INTEGER. If there are no constants or symbolic<br />

constants of type COMPLEX*16 in a constant expression, the type of the constant expression will be<br />

COMPLEX*16 if it contains at least one constant or symbolic constant of type COMPLEX and at least one<br />

constant or symbolic constant of type DOUBLE PRECISION. <strong>Open</strong> <strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> supports this<br />

type of constant expression as an extension of the <strong>FORTRAN</strong> <strong>77</strong> language.<br />

Example:<br />

(123,0D0)<br />

(-753,12.3D0)*2<br />

-(12D0,-12.4)-(1.0,.2)<br />

7.1.4 Data Type of Arithmetic Expressions<br />

Evaluating an arithmetic expression produces a result which has a type. The type of the result is<br />

determined by the type of its operands. The following table describes the rules for determining the type of<br />

arithmetic expressions. The letters I, R, D, C and Z stand for INTEGER, REAL, DOUBLE PRECISION,<br />

COMPLEX and COMPLEX*16 respectively. An entry in the table represents the data type of the result<br />

when the operands are of the type indicated by the row and column in which the entry belongs. The<br />

column represents the type of the operand to the right of the operator, and the row represents the type of the<br />

operand to the left of the operator. The table is valid for all of the arithmetic operators.<br />

<br />

op I*1 I*2 I*4 R D C Z<br />

I*1 I*1 I*2 I*4 R D C Z<br />

I*2 I*2 I*2 I*4 R D C Z<br />

I*4 I*4 I*4 I*4 R D C Z<br />

R R R R R D C Z<br />

D D D D D D Z Z<br />

C C C C C Z C Z<br />

Z Z Z Z Z Z Z Z<br />

Notes:<br />

1. I*1 represents the INTEGER*1 data type, I*2 represents the INTEGER*2 data type, and I*4<br />

represents the INTEGER or INTEGER*4 data type.<br />

2. The data type of the result obtained by dividing an integer datum by an integer datum is also of<br />

type INTEGER even though the mathematical result may not be an integer. This result is called<br />

the integer quotient and is defined as the integer part of the mathematical quotient.<br />

3. <strong>Open</strong> <strong>Watcom</strong> <strong>FORTRAN</strong> <strong>77</strong> supports the double precision complex data type<br />

(COMPLEX*16) as an extension of the <strong>FORTRAN</strong> <strong>77</strong> language. Combining an operand of type<br />

DOUBLE PRECISION with an operand of type COMPLEX yields a result of type<br />

COMPLEX*16.<br />

Arithmetic Expressions 1<strong>77</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!