
OpenVMS VAX RTL Mathematics (MTH$) Manual
MTH$xCMPLX
The Complex Number Made from D or GFloating Point routines return a
complex number from two D or Gfloating input values.
Format
MTH$DCMPLX complx ,realpart ,imaginarypart
MTH$GCMPLX complx ,realpart ,imaginarypart
Each of the above formats accepts one of floatingpoint complex types
as input.
RETURNS
None.
Arguments
complx
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
write only 
mechanism: 
by reference 
The floatingpoint complex value of a complex number. The complex
exponential functions that have Dfloating complex and Gfloating
complex input values write the address of this floatingpoint complex
value into complx. For MTH$DCMPLX,
complx specifies a Dfloating complex number. For
MTH$GCMPLX, complx specifies a Gfloating complex
number. For MTH$CMPLX, complx is not used.
realpart
OpenVMS usage: 
floating_point 
type: 
D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
Real part of a complex number. The realpart argument
is the address of a floatingpoint number that contains this real part,
r, of (r,i). For MTH$DCMPLX, realpart specifies a
Dfloating number. For MTH$GCMPLX, realpart specifies
a Gfloating number.
imaginarypart
OpenVMS usage: 
floating_point 
type: 
D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
Imaginary part of a complex number. The imaginarypart
argument is the address of a floatingpoint number that contains this
imaginary part, i, of (r,i). For MTH$DCMPLX,
imaginarypart specifies a Dfloating number. For
MTH$GCMPLX, imaginarypart specifies a Gfloating
number.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$xCMPLX routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

Example

C+
C This Fortran example forms two Dfloating
C point complex numbers using MTH$CMPLX
C and the Fortran random number generator RAN.
C
C Declare Z and MTH$DCMPLX as complex values, and R
C and I as real values. MTH$DCMPLX takes two real
C Dfloating point values and returns one
C COMPLEX*16 number.
C
C
COMPLEX*16 Z
REAL*8 R,I
INTEGER M
M = 1234567
R = RAN(M)
I = RAN(M)
CALL MTH$DCMPLX(Z,R,I)
C+
C Z is a complex number (r,i) with real part "r" and imaginary
C part "i".
C
TYPE *, ' The two input values are:',R,I
TYPE *, ' The complex number z is',Z
END

This Fortran example demonstrates how to make a procedure call to
MTH$DCMPLX. Notice the difference in the precision of the output
generated.
The two input values are: 0.8535407185554504 0.2043401598930359
The complex number z is (0.8535407185554504,0.2043401598930359)

MTH$CONJG
The Conjugate of a Complex Number (FFloating Value) routine returns
the complex conjugate (r,i) of a complex number (r,i) as an Ffloating
value.
Format
MTH$CONJG complexnumber
RETURNS
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
write only 
mechanism: 
by value 
Complex conjugate of a complex number. MTH$CONJG returns an Ffloating
complex number.
Argument
complexnumber
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
read only 
mechanism: 
by reference 
A complex number (r,i), where r and i are floatingpoint numbers. The
complexnumber argument is the address of this
floatingpoint complex number. For MTH$CONJG,
complexnumber specifies an Ffloating number.
Description
The MTH$CONJG routine returns the complex conjugate (r,i) of a complex
number (r,i) as an Ffloating value.
See MTH$xCONJG for the descriptions of the D and Gfloating point
versions of this routine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$CONJG routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$xCONJG
The Conjugate of a Complex Number routine returns the complex conjugate
(r,i) of a complex number (r,i).
Format
MTH$DCONJG complexconjugate ,complexnumber
MTH$GCONJG complexconjugate ,complexnumber
Each of the above formats accepts one of the floatingpoint complex
types as input.
RETURNS
None.
Arguments
complexconjugate
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
write only 
mechanism: 
by reference 
The complex conjugate (r,i) of the complex number specified by
complexnumber. MTH$DCONJG and MTH$GCONJG write the
address of this complex conjugate into
complexconjugate. For MTH$DCONJG, the
complexconjugate argument specifies the address of a
Dfloating complex number. For MTH$GCONJG, the
complexconjugate argument specifies the address of a
Gfloating complex number.
complexnumber
OpenVMS usage: 
complex_number 
type: 
D_floating complex, G_floating complex 
access: 
read only 
mechanism: 
by reference 
A complex number (r,i), where r and i are floatingpoint numbers. The
complexnumber argument is the address of this
floatingpoint complex number. For MTH$DCONJG,
complexnumber specifies a Dfloating number. For
MTH$GCONJG, complexnumber specifies a Gfloating
number.
Description
The MTH$xCONJG routines return the complex conjugate (r,i) of a
complex number (r,i).
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$xCONJG routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

Example

C+
C This Fortran example forms the complex conjugate
C of a Gfloating complex number using MTH$GCONJG
C and the Fortran random number generator RAN.
C
C Declare Z, Z_NEW, and MTH$GCONJG as a complex values.
C MTH$GCONJG will return the complex conjugate
C value of Z: Z_NEW = MTH$GCONJG(Z).
C
COMPLEX*16 Z,Z_NEW,MTH$GCONJG
COMPLEX*16 MTH$GCMPLX
REAL*8 R,I,MTH$GREAL,MTH$GIMAG
INTEGER M
M = 1234567
C+
C Generate a random complex number with the Fortran generic CMPLX.
C
R = RAN(M)
I = RAN(M)
Z = MTH$GCMPLX(R,I)
TYPE *, ' The complex number z is',z
TYPE 1,MTH$GREAL(Z),MTH$GIMAG(Z)
1 FORMAT(' with real part ',F20.16,' and imaginary part',F20.16)
TYPE *, ' '
C+
C Compute the complex absolute value of Z.
C
Z_NEW = MTH$GCONJG(Z)
TYPE *, ' The complex conjugate value of',z,' is',Z_NEW
TYPE 1,MTH$GREAL(Z_NEW),MTH$GIMAG(Z_NEW)
END

This Fortran example demonstrates how to make a function call to
MTH$GCONJG. Because Gfloating numbers are used, the examples must be
compiled with the statement "Fortran/G filename".
The output generated by this program is as follows:
The complex number z is (0.853540718555450,0.204340159893036)
with real part 0.8535407185554504
and imaginary part 0.2043401598930359
The complex conjugate value of
(0.853540718555450,0.204340159893036) is
(0.853540718555450,0.204340159893036)
with real part 0.8535407185554504
and imaginary part 0.2043401598930359

MTH$xCOS
The Cosine of Angle Expressed in Radians routine returns the cosine of
a given angle (in radians).
Format
MTH$COS angleinradians
MTH$DCOS angleinradians
MTH$GCOS angleinradians
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$COS_R4
MTH$DCOS_R7
MTH$GCOS_R7
Each of the above JSB entry points accepts one of the floatingpoint
types as input.
RETURNS
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
write only 
mechanism: 
by value 
Cosine of the angle. MTH$COS returns an Ffloating number. MTH$DCOS
returns a Dfloating number. MTH$GCOS returns a Gfloating number.
Argument
angleinradians
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
The angle in radians. The angleinradians argument is
the address of a floatingpoint number. For MTH$COS,
angleinradians is an Ffloating number. For
MTH$DCOS, angleinradians specifies a Dfloating
number. For MTH$GCOS, angleinradians specifies a
Gfloating number.
Description
See MTH$xSINCOS for the algorithm used to compute the cosine.
See MTH$HCOS for the description of the Hfloating point version of
this routine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$xCOS routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$xCOSD
The Cosine of Angle Expressed in Degrees routine returns the cosine of
a given angle (in degrees).
Format
MTH$COSD angleindegrees
MTH$DCOSD angleindegrees
MTH$GCOSD angleindegrees
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$COSD_R4
MTH$DCOSD_R7
MTH$GCOSD_R7
Each of the above JSB entry points accepts one of the floatingpoint
types as input.
RETURNS
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
write only 
mechanism: 
by value 
Cosine of the angle. MTH$COSD returns an Ffloating number. MTH$DCOSD
returns a Dfloating number. MTH$GCOSD returns a Gfloating number.
Argument
angleindegrees
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
Angle (in degrees). The angleindegrees argument is
the address of a floatingpoint number. For MTH$COSD,
angleindegrees specifies an Ffloating number. For
MTH$DCOSD, angleindegrees specifies a Dfloating
number. For MTH$GCOSD, angleindegrees specifies a
Gfloating number.
Description
See MTH$xSINCOS for the algorithm used to compute the cosine.
See MTH$HCOSD for the description of the Hfloating point version of
this routine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$xCOSD routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$xCOSH
The Hyperbolic Cosine routine returns the hyperbolic cosine of the
input value.
Format
MTH$COSH floatingpointinputvalue
MTH$DCOSH floatingpointinputvalue
MTH$GCOSH floatingpointinputvalue
Each of the above formats accepts one of the floatingpoint types as
input.
RETURNS
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
write only 
mechanism: 
by value 
The hyperbolic cosine of the input value
floatingpointinputvalue. MTH$COSH returns an Ffloating
number. MTH$DCOSH returns a Dfloating number. MTH$GCOSH returns a
Gfloating number.
Argument
floatingpointinputvalue
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
The input value. The floatingpointinputvalue
argument is the address of this input value. For MTH$COSH,
floatingpointinputvalue specifies an Ffloating
number. For MTH$DCOSH, floatingpointinputvalue
specifies a Dfloating number. For MTH$GCOSH,
floatingpointinputvalue specifies a Gfloating
number.
Description
Computation of the hyperbolic cosine depends on the magnitude of the
input argument. The range of the function is partitioned using four
datatypedependent constants: a(z), b(z), and c(z). The subscript
z indicates the data type. The constants depend on the number
of exponent bits (e) and the number of fraction bits
(f) associated with the data type (z).
The values of e and f are:
z 
e 
f 
F

8

24

D

8

56

G

11

53

The values of the constants in terms of e and f are:
Variable 
Value 
a(z)

2
^{(f/2)}

b(z)

CEILING[ (f+1)/2*ln(2) ]

c(z)

(2
^{e1})*ln(2)

Based on the above definitions, zCOSH(X) is computed as follows:
Value of X 
Value Returned 
X < a(z)

1

a(z)
<= X < .25

Computed using a power series expansion in X
^{2}

.25
<= X < b(z)

(zEXP(X) + 1/zEXP(X))/2

b(z)
<= X < c(z)

zEXP(X)/2

c(z)
<= x

Overflow occurs

See MTH$HCOSH for the description of the Hfloating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$xCOSH routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$_FLOOVEMAT

Floatingpoint overflow in Math Library: the absolute value of
floatingpointinputvalue is greater than about
yyy; LIB$SIGNAL copies the reserved operand to the signal
mechanism vector. The result is the reserved operand 0.0 unless a
condition handler changes the signal mechanism vector.
The values of
yyy are:
MTH$COSH88.722
MTH$DCOSH88.722
MTH$GCOSH709.782

MTH$CSIN
The Sine of a Complex Number (FFloating Value) routine returns the
sine of a complex number (r,i) as an Ffloating value.
Format
MTH$CSIN complexnumber
RETURNS
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
write only 
mechanism: 
by value 
Complex sine of the complex number. MTH$CSIN returns an Ffloating
complex number.
Argument
complexnumber
OpenVMS usage: 
complex_number 
type: 
F_floating complex 
access: 
read only 
mechanism: 
by reference 
A complex number (r,i), where r and i are floatingpoint numbers. The
complexnumber argument is the address of this complex
number. For MTH$CSIN, complexnumber specifies an
Ffloating complex number.
Description
The complex sine is computed as follows: complexsine = (SIN(r) *
COSH(i), COS(r) * SINH(i))
See MTH$CxSIN for the descriptions of the D and Gfloating point
versions of this routine.
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$CSIN routine encountered a floatingpoint
reserved operand due to incorrect user input. A floatingpoint reserved
operand is a floatingpoint datum with a sign bit of 1 and a biased
exponent of 0. Floatingpoint reserved operands are reserved for future
use by Compaq.

MTH$_FLOOVEMAT

Floatingpoint overflow in Math Library: the absolute value of
i is greater than about 88.029 for Ffloating values.

