• Aucun résultat trouvé

6.3 .2.6 The Arithmetic Functions

Dans le document FORTRAN-a6 USER'S GUIDE (Page 66-70)

The Arithmetic functions perform specific arithmetic functions. The syntax is as follows:

name ( arg>

where

name is the intrinsic function name.

arg is the argument on which the function will be performed. All functions expect and return floating-point values.

See Table 6-7 for details.

The PROJ Function provides a mechanism for uniformly handling complex infinities.

A complex infinity is any complex number with at least one infinite component.

Whenever users are performing algebraic computations in which they suspect that a complex infinity may arise as input to an algebraic operation, they should apply the PROJ function to such inputs.

The PROJ function is defined as follows:

PROJ«x.y))=(INFINITY, SIGN(O,Y)), if either X or Y is infinite;

= (x,y), otherwise.

The AI MAG function returns the imaginary part of a COMPLEX argument.

You can use the specific name AIMAG for COMPLEX*8 arguments, and the specific name DAIMAG for COMPLEX* 16 arguments.

The CONJG function returns the conjugate of a COMPLEX argument.

You can use the specific name CONJG for COMPLEX*8 arguments, and the specific name DCONJG for COMPLEX*16 arguments.

The SQRT function returns the square root of an argument. The argument must be greater than or equal to zero.

For REAL*8 and DOUBLE PRECISION arguments, you can use the specific name DSQRT in place of SQRT. You can use the specific name CSQRT for COMPLEX*8 arguments. For COMPLEX* 16 arguments, you can use the specific name CDSQR T.

The EXP function returns a value that is equal to e raised to the power of the argument.

Table 6-6. Length and Index Functions

Specific Type

Generic Category Function

Name Name Arguments Results

LEN length Determine

the Length of Character

CHARACTER INTEGER Entity

INDEX Index of Return CHARACTER INTEGER

Substring Location of Substring arg2 in String arg1

Fortran-86

Fortran-86

Table 6-7. Arithmetic Functions

Generic Spec:lfic Type

Category Function

Name Name Arguments Results

AIMAG AIMAG Arithmetic Returns COMPLEX*S REAL

DAIMAG Imaginary COMPLEX*16 DOUBLE

Part of a PRECISION

Complex Argument

CONJG CONJG Arithmetic Returns COMPLEX COMPLEX

DCONJG Conjugate of COMPLEX*S COMPLEX*S

a Complex COMPLEX*16 COMPLEX*16 Argument

CSORT COMPLEX*S COMPLEX*S

CDSQRT COMPLEX*16 COMPLEX*16

EXP EXP Arithmetic Return e REAL*4 REAL*4

DEXP Raised to REAL*S REAL*S

DEXP Power of DOUBLE DOUBLE

Argument PRECISION PRECISION TEMPREAL TEMPREAL

CEXP COMPLEX*S COMPLEX*S

CDEXP COMPLEX*16 COMPLEX*16

LOG ALOG Arithmetic Return REAL*4 REAL*4

DLOG Natural REAL*S REAL*S

DLOG Logarithm DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

CLOG COMPLEX*S COMPLEX*S

CDLOG COMPLEX*16 COMPLEX*16

LOG10 ALOG10 Arithmetic Return REAL*4 REAL*4

DLOG10 Common REAL*S REAL*S

DLOG10 Logarithm DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

For REAL '4<8 or DOUBLE PRECISION arguments, you can use the specific name DEXP in pIa\. ~ of EXP. For COMPLEX*8 arguments, you can use the specific name CEXP. You ca. use the specific name CDEXP for COMPLEX*16 arguments.

The LOG function . .!turns the natural logarithm of an argument. The argument must be greater than or equal to zero.

For REAL *4 arguments, you can use the specific name ALOG in place of LOG. For REAL*8 or DOUBLE PRECISION arguments, you can use the specific name DLOG in place of LOG. You can use the specific name CLOG for COMPLEX*8 arguments.

For COMPLEX* 16 arguments, you can use the specific name CDLOG.

The ALOGIO fundion returns the common logarithm of an argument. The argument must be greater than zero.

For REAL*8 or DOUBLE PRECISION arguments, you can use the specific name DLOG lOin place of ALOG 1 O.

6.3 .2 . 7 The Trigonometric Functions

The trigonometric functions perform specified trigonometric functions. The syntax is as follows:

name (arg)

Subprograms

6-15

Subprograms

6-16

where name arg

is the intrinsic function name.

is the value on which the function will be performed. All trigonometric functions expect and return floating-point values.

See Table 6-8 for details.

The SIN function returns the sine of an argument. The absolute value of the argument is not restricted to be less than 2PI. The range of the result is - 1 < result < 1.

For REAL*8 and DOUBLE PRECISION arguments, you can use the specific name DSIN in place of SIN. You can use the specific name CSINH for COMPLEX*8 arguments. For COMPLEX* 16 arguments, you can use the specific name CDSINH.

The COS function returns the cosine of an argument. The absolute value of the argument is not restricted to be less than 2PI. The range of the result is - 1 < result

<1.

For REAL*8 and DOUBLE PRECISION arguments, you can use the specific name DCOS in place of COS. You can use the specific name COSH for arguments that are COMPLEX*8. For arguments that are COMPLEX* 16, you can use the specific name CDCOSH.

The TAN function returns the tangent of an argument. The absolute value of the argument is not restricted to be less than 2PI.

For REAL*8 and DOUBLE PRECISION arguments, you can use the specific name DTAN in place of TAN. You can use the specific name CTANH for COMPLEX*8 arguments. For COMPLEX* 16 arguments, you can use the specific name CDTANH.

The ASIN function returns the arcsine of an argument. The absolute value of the argument must be < 1. The range of the result is - PI/2 < result < PI/2.

For REAL*8 or DOUBLE PRECISION arguments, you can use the specific name DASIN in place of ASIN. You can use the specific name CASIN for COMPLEX*8 arguments. For COMPLEX* 16 arguments, you can use the specific name CDASIN.

The ACOS function returns the arccosine of an argument. The absolute value of the argument must be < 1. The range of the result is 0 < result < PI.

For REAL*8 or DOUBLE PRECISION arguments, you can use the specific name DACOS in place of ACOS. You can use the specific name CACOS for COMPLEX*8 arguments. For COMPLEX* 16 arguments, you can use the specific name CDACOS.

The ATAN function returns the arctangent of an argument. The range of the result polar coordinates of a point whose rectangular coordinates are argl and arg2, its first and second arguments, respectively. The restriction to principal value means that the result satisfies - PI < result < PI, and guarantees that any finite point other than

Fortran-86

Fortran-86 Subprograms

Tnble 6-8. Trigonometric Functions

Type Generic Specific

Category FUl1lction

Name Name Arguments Results

SIN Trigonometric Return REAL*4 REAL*4

DSIN Sine REAL*8 REAL*8

DSIN DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

CSIN COMPLEX*8 COMPLEX*8

CDSIN COMPLEX*16 COMPLEX*16

COS Trigonometric Return REAL*4 REAL*4

DCOS Cosine REAL*8 REAL*8

DCOS DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

CCOS COMPLEX*8 COMPLEX*8

CDCOS COMPLEX*16 COMPLEX*16

TAN Trigonometric Return REAL*4 REAL*4

DTAN Tangent REAL*8 REAL*8

DTAN DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

CTAN COMPLEX*8 COMPLEX*8

CDTAN COMPLEX*16 COMPLEX*16

ASIN Trigonometric Return REAL*4 REAL*4

DASII\J Arcsine REAL*8 REAL*8

DASIN DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

CASIN COMPLEX*8 COMPLEX*8

CDASIN COMPLEX*16 COMPLEX*16

ACOS Trigonometric Return REAL*4 REAL*4

DACOS Arccosine REAL*8 REAL*8

DACOS DOUBLE DOUBLE

PRECISION PRECISION TEMPREAL TEMPREAL

CACOS COMPLEX*8 COMPLEX*8

CDACOS COMPLEX*16 COMPLEX*16

ATAN Trigonometric Return REAL*4 REAL*4

DATAN Arctangent REAL*8 REAL*8

DATAN with one DOUBLE DOUBLE

Argument PRECISION PRECISION TEMPREAL TEMPREAL

CATAN COMPLEX*8 COMPLEX*8

CDATAN COMPLEX*16 COMPLEX*16

ATAN2 Trigonometric Return REAL*4 REAL*4

DATAN2 Arctangent REAL*8 REAL*8

DATAN2 with two DOUBLE DOUBLE

Arguments PRECISION PRECISION TEMPREAL TEMPREAL

6-17

Subprograms

6-18

the origin has a unique angular component. The function assigns angular components to the origin (± 0, ± 0) also, namely +0 or ± 'Jr, depending on the signs of the rectan-gular coordinates.

The results for other finite inputs are as follows:

ATAN(arg2/argJ), if argl

>

0

SIN(PI/2,arg2), if argl =0 and arg2 =F 0

ATAN(arg2/argl)

+

SIGN(PI,arg2), if argl <0

Note that a correct result is returned even if some of the arguments are infinite.

Dans le document FORTRAN-a6 USER'S GUIDE (Page 66-70)