HP Fortran for OpenVMS
Language Reference Manual


Previous Contents Index

9.4.17 ATAN (X)

Description: Produces the arctangent of X.
Class: Elemental function; Generic
Arguments: X must be of type real.
Results: The result type is the same as X and is expressed in radians. The value lies in the range --Pi sign/2 to Pi sign/2.
Specific Name Argument Type Result Type
ATAN REAL(4) REAL(4)
DATAN REAL(8) REAL(8)
QATAN REAL(16) REAL(16)

Examples

ATAN (1.5874993) has the value 1.008666.

9.4.18 ATAND (X)

Description: Produces the arctangent of X.
Class: Elemental function; Generic
Arguments: X must be of type real and must be greater than or equal to zero.
Results: The result type is the same as X and is expressed in radians.
Specific Name Argument Type Result Type
ATAND REAL(4) REAL(4)
DATAND REAL(8) REAL(8)
QATAND REAL(16) REAL(16)

Examples

ATAND (0.0874679) has the value 4.998819.

9.4.19 ATAN2 (Y, X)

Description: Produces an arctangent. The result is the principal value of the argument of the nonzero complex number (X, Y).
Class: Elemental function; Generic
Arguments: Y Must be of type real.
  X Must have the same type and kind parameters as Y. If Y has the value zero, X cannot have the value zero.
Results: The result type is the same as X and is expressed in radians. The value lies in the range --Pi sign < ATAN2 (Y,X) <= Pi sign. If X /= zero, the result is approximately equal to the value of arctan (Y/X).

If Y > zero, the result is positive.

If Y < zero, the result is negative.

If Y = zero, the result is zero (if X > zero) or Pi sign (if X < zero).

If X = zero, the absolute value of the result is Pi sign/2.

Specific Name Argument Type Result Type
ATAN2 REAL(4) REAL(4)
DATAN2 REAL(8) REAL(8)
QATAN2 REAL(16) REAL(16)

Examples

ATAN2 (2.679676, 1.0) has the value 1.213623.

If Y has the value <left[ symbol><matrix symbol> 1& 1<cr symbol> -1&-1<cr symbol> <right] symbol> and X has the value <left[ symbol><matrix symbol> -1&1<cr symbol> -1&1<cr symbol> <right] symbol> , then ATAN2 (Y, X) is <left[ symbol><matrix symbol> 3Pi sign 4
& Pi sign 4

<cr symbol> -3Pi sign 4

&-Pi sign 4

<cr symbol> <right] symbol> .

9.4.20 ATAN2D (Y, X)

Description: Produces an arctangent. The result is the principal value of the argument of the nonzero complex number (X, Y).
Class: Elemental function; Generic
Arguments: 1 Y Must be of type real.
  X Must have the same type and kind parameters as Y.
Results: The result type is the same as X and is expressed in degrees. The value lies in the range --180 degrees to 180 degrees. If X /= zero, the result is approximately equal to the value of arctan (Y/X).

If Y > zero, the result is positive.

If Y < zero, the result is negative.

If Y = zero, the result is zero (if X > zero) or 180 degrees (if X < zero).

If X = zero, the absolute value of the result is 90 degrees.


1Both arguments must not have the value zero.

Specific Name Argument Type Result Type
ATAN2D REAL(4) REAL(4)
DATAN2D REAL(8) REAL(8)
QATAN2D REAL(16) REAL(16)

Examples

ATAN2D (2.679676, 1.0) has the value 69.53546.

9.4.21 BIT_SIZE (I)

Description: Returns the number of bits in an integer type.
Class: Inquiry function; Generic
Arguments: I must be of type integer.
Results: The result is a scalar integer with the same kind parameter as I. The result value is the number of bits ( s) defined by the bit model for integers with the kind parameter of the argument. For information on the bit model, see Section D.3.

Examples

BIT_SIZE (1_2) has the value 16 because the KIND=2 integer type contains 16 bits.

9.4.22 BTEST (I, POS)

Description: Tests a bit of an integer argument.
Class: Elemental function; Generic
Arguments: I Must be of type integer.
  POS Must be of type integer. It must not be negative and it must be less than BIT_SIZE (I).

The rightmost (least significant) bit of I is in position 0.

Results: The result is of type default logical.

The result is true if bit POS of I has the value 1. The result is false if POS has the value zero. For more information on bit functions, see Section 9.3.3.

For information on the model for the interpretation of an integer value as a sequence of bits, see Section D.3.

The setting of compiler options specifying integer size can affect this function.

Specific Name Argument Type Result Type
  INTEGER(1) LOGICAL(1)
BITEST INTEGER(2) LOGICAL(2)
BTEST 1 INTEGER(4) LOGICAL(4)
BKTEST INTEGER(8) LOGICAL(8)

1Or BJTEST

Examples

BTEST (9, 3) has the value true.

If A has the value <left[ symbol><matrix symbol> 1&2<cr symbol> 3&4<cr symbol> <right] symbol> , the value of BTEST (A, 2) is <left[ symbol><matrix symbol> false&false<cr symbol> false&true<cr symbol> <right] symbol> and the value of BTEST (2, A) is <left[ symbol><matrix symbol> true&false<cr symbol> false&false<cr symbol> <right] symbol> .

9.4.23 CEILING (A [,KIND])

Description: Returns the smallest integer greater than or equal to its argument.
Class: Elemental function; Generic
Arguments: A Must be of type real.
  KIND (opt) Must be a scalar integer initialization expression. This argument is a Fortran 95 feature.
Results: The result is of type integer. If KIND is present, the kind parameter of the result is that specified by KIND; otherwise, the kind parameter of the result is that of default integer. If the processor cannot represent the result value in the kind of the result, the result is undefined.

The value of the result is equal to the smallest integer greater than or equal to A.

Examples

CEILING (4.8) has the value 5.

CEILING (--2.55) has the value --2.0.

9.4.24 CHAR (I [,KIND])

Description: Returns the character in the specified position of the processor's character set. It is the inverse of the function ICHAR.
Class: Elemental function; Generic
Arguments: I Must be of type integer with a value in the range 0 to n - 1, where n is the number of characters in the processor's character set.
  KIND (opt) Must be a scalar integer initialization expression.
Results: The result is of type character with length 1. The kind parameter is that of default character type.

The result is the character in position I of the processor's character set. ICHAR(CHAR (I, KIND(C))) has the value I for 0 to n - 1 and CHAR(ICHAR(C), KIND(C)) has the value C for any character C capable of representation in the processor.

Specific Name Argument Type Result Type
  INTEGER(1) CHARACTER
  INTEGER(2) CHARACTER
CHAR 1 INTEGER(4) CHARACTER
  INTEGER(8) CHARACTER

1This specific function cannot be passed as an actual argument.

Examples

CHAR (76) has the value ' L ' .

CHAR (94) has the value ' ^ ' .

9.4.25 CMPLX (X [,Y] [,KIND])

Description: Converts an argument to complex type. This function must not be passed as an actual argument.
Class: Elemental function; Generic
Arguments: X Must be of type integer, real, or complex.
  Y (opt) Must be of type integer or real. It must not be present if X is of type complex.
  KIND (opt) Must be a scalar integer initialization expression.
Results: The result is of type complex (COMPLEX(4) or COMPLEX*8 ). If KIND is present, the kind parameter is that specified by KIND; otherwise, the kind parameter is that of default real type.

If only one noncomplex argument appears, it is converted into the real part of the result value and zero is assigned to the imaginary part. If Y is not specified and X is complex, the result value is CMPLX (REAL(X), AIMAG(X)).

If two noncomplex arguments appear, the complex value is produced by converting the first argument into the real part of the value, and converting the second argument into the imaginary part.

CMPLX(X, Y, KIND) has the complex value whose real part is REAL(X, KIND) and whose imaginary part is REAL(Y, KIND).

The setting of compiler options specifying real size can affect this function.

Examples

CMPLX (--3) has the value (--3.0, 0.0).

CMPLX (4.1, 2.3) has the value (4.1, 2.3).

9.4.26 CONJG (Z)

Description: Calculates the conjugate of a complex number.
Class: Elemental function; Generic
Arguments: Z must be of type complex.
Results: The result type is the same as Z. If Z has the value (x, y), the result has the value (x, --y).
Specific Name Argument Type Result Type
CONJG COMPLEX(4) COMPLEX(4)
DCONJG COMPLEX(8) COMPLEX(8)
QCONJG COMPLEX(16) COMPLEX(16)

Examples

CONJG ((2.0, 3.0)) has the value (2.0, --3.0).

CONJG ((1.0, --4.2)) has the value (1.0, 4.2).

9.4.27 COS (X)

Description: Produces the cosine of X.
Class: Elemental function; Generic
Arguments: X must be of type real or complex. It must be in radians and is treated as modulo 2*Pi sign. (If X is of type complex, its real part is regarded as a value in radians.)
Results: The result type is the same as X.
Specific Name Argument Type Result Type
COS REAL(4) REAL(4)
DCOS REAL(8) REAL(8)
QCOS REAL(16) REAL(16)
CCOS 1 COMPLEX(4) COMPLEX(4)
CDCOS 2 COMPLEX(8) COMPLEX(8)
CQCOS COMPLEX(16) COMPLEX(16)

1The setting of compiler options specifying real size can affect CCOS.
2This function can also be specified as ZCOS.

Examples

COS (2.0) has the value --0.4161468.

COS (0.567745) has the value 0.8431157.

9.4.28 COSD (X)

Description: Produces the cosine of X.
Class: Elemental function; Generic
Arguments: X must be of type real. It must be in degrees and is treated as modulo 360.
Results: The result type is the same as X.
Specific Name Argument Type Result Type
COSD REAL(4) REAL(4)
DCOSD REAL(8) REAL(8)
QCOSD REAL(16) REAL(16)

Examples

COSD (2.0) has the value 0.9993908.

COSD (30.4) has the value 0.8625137.

9.4.29 COSH (X)

Description: Produces a hyperbolic cosine.
Class: Elemental function; Generic
Arguments: X must be of type real.
Results: The result type is the same as X.
Specific Name Argument Type Result Type
COSH REAL(4) REAL(4)
DCOSH REAL(8) REAL(8)
QCOSH REAL(16) REAL(16)

Examples

COSH (2.0) has the value 3.762196.

COSH (0.65893) has the value 1.225064.


Previous Next Contents Index