
OpenVMS VAX RTL Mathematics (MTH$) Manual
MTH$xSIN
The Sine of Angle Expressed in Radians routine returns the sine of a
given angle (in radians).
Format
MTH$SIN angleinradians
MTH$DSIN angleinradians
MTH$GSIN angleinradians
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$SIN_R4
MTH$DSIN_R7
MTH$GSIN_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 
Sine of the angle specified by angleinradians.
MTH$SIN returns an Ffloating number. MTH$DSIN returns a Dfloating
number. MTH$GSIN returns a Gfloating number.
Argument
angleinradians
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
Angle (in radians). The angleinradians argument is
the address of a floatingpoint number that is this angle. For MTH$SIN,
angleinradians specifies an Ffloating number. For
MTH$DSIN, angleinradians specifies a Dfloating
number. For MTH$GSIN, angleinradians specifies a
Gfloating number.
Description
See MTH$xSINCOS for the algorithm used to compute this sine.
See MTH$HSIN for the description of the Hfloating point version of
this routine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$xSIN 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$xSINCOS
The Sine and Cosine of Angle Expressed in Radians routine returns the
sine and cosine of a given angle (in radians).
Format
MTH$SINCOS angleinradians ,sine ,cosine
MTH$DSINCOS angleinradians ,sine ,cosine
MTH$GSINCOS angleinradians ,sine ,cosine
MTH$HSINCOS angleinradians ,sine ,cosine
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$SINCOS_R5
MTH$DSINCOS_R7
MTH$GSINCOS_R7
MTH$HSINCOS_R7
Each of the above JSB entry points accepts one of the floatingpoint
types as input.
RETURNS
MTH$SINCOS, MTH$DSINCOS, MTH$GSINCOS, and MTH$HSINCOS return the sine
and cosine of the input angle by reference in the sine
and cosine arguments.
Arguments
angleinradians
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating, H_floating 
access: 
read only 
mechanism: 
by reference 
Angle (in radians) whose sine and cosine are to be returned. The
angleinradians argument is the address of a
floatingpoint number that is this angle. For MTH$SINCOS,
angleinradians is an Ffloating number. For
MTH$DSINCOS, angleinradians is a Dfloating number.
For MTH$GSINCOS, angleinradians is a Gfloating
number. For MTH$HSINCOS, angleinradians is an
Hfloating number.
sine
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating, H_floating 
access: 
write only 
mechanism: 
by reference 
Sine of the angle specified by angleinradians. The
sine argument is the address of a floatingpoint
number. MTH$SINCOS writes an Ffloating number into
sine. MTH$DSINCOS writes a Dfloating number into
sine. MTH$GSINCOS writes a Gfloating number into
sine. MTH$HSINCOS writes an Hfloating number into
sine.
cosine
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating, H_floating 
access: 
write only 
mechanism: 
by reference 
Cosine of the angle specified by angleinradians. The
cosine argument is the address of a floatingpoint
number. MTH$SINCOS writes an Ffloating number into
cosine. MTH$DSINCOS writes a Dfloating number into
cosine. MTH$GSINCOS writes a Gfloating number into
cosine. MTH$HSINCOS writes an Hfloating number into
cosine.
Description
All routines with JSB entry points accept a single argument in R0:Rm,
where m, which is defined below, is dependent on the data type.
Data Type 
m 
F_floating

0

D_floating

1

G_floating

1

H_floating

3

In general, RunTime Library routines with JSB entry points return one
value in R0:Rm. The MTHxSINCOS routine returns two values, however. The
sine of angleinradians is returned in R0:Rm and the
cosine of angleinradians is returned in
(R<m+1>:R<2*m+1>).
In radians, the computation of zSIN(X) and zCOS(X) is based on the
following polynomial expansions:
sin(X) = X  X^{3}/(3!) + X^{5}/(5!) 
X^{7}/(7!) ...
=X + X*P(X^{2}), where
P(y) = y/(3!) + y^{2}/(5!) + y^{3}/(7!) ...
cos(X) = 1  X^{2}/(2!) + x^{4}/(4!)
X^{6}/(6!) ...
=Q(X^{2}), where
Q(y) = (1  y/(2!) + y^{2}/(4!) + y^{3}/(6!) ...)
 If X < 2^{ (f/2)},
then zSIN(X) = X and zCOS(X) = 1
(see the section on MTH$zCOSH for
the definition of f)
 If 2^{f/2} <= X < Pi sign/4,
then zSIN(X) = X + P(X^{2})
and zCOS(X) = Q(X^{2})
 If Pi sign/4 <= X and X > 0,
 Let J = INT(X/(Pi sign/4))
and I = J modulo 8
 If J is even, let Y = X  J* (Pi sign/4)
otherwise, let Y = (J+1)* (Pi sign/4)  X With the above
definitions, the following table relates zSIN(X) and zCOS(X) to zSIN(Y)
and zCOS(Y):
Value of I 
zSIN(X) 
zCOS(X) 
0

zSIN(Y)

zCOS(Y)

1

zCOS(Y)

zSIN(Y)

2

zCOS(Y)

zSIN(Y)

3

zSIN(Y)

zCOS(Y)

4

zSIN(Y)

zCOS(Y)

5

zCOS(Y)

zSIN(Y)

6

zCOS(Y)

zSIN(Y)

7

zSIN(Y)

zCOS(Y)

 zSIN(Y) and zCOS(Y) are computed as follows:
zSIN(Y) = Y + P(Y^{2}),
and zCOS(Y) = Q(Y^{2})
 If Pi sign/4 <= X and X < 0,
then zSIN(X) = zSIN(X)
and zCOS(X) = zCOS(X)
Condition Value Returned
SS$_ROPRAND

Reserved operand. The MTH$xSINCOS 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$xSINCOSD
The Sine and Cosine of Angle Expressed in Degrees routine returns the
sine and cosine of a given angle (in degrees).
Format
MTH$SINCOSD angleindegrees ,sine ,cosine
MTH$DSINCOSD angleindegrees ,sine ,cosine
MTH$GSINCOSD angleindegrees ,sine ,cosine
MTH$HSINCOSD angleindegrees ,sine ,cosine
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$SINCOSD_R5
MTH$DSINCOSD_R7
MTH$GSINCOSD_R7
MTH$HSINCOSD_R7
Each of the above JSB entry points accepts one of the floatingpoint
types as input.
RETURNS
MTH$SINCOSD, MTH$DSINCOSD, MTH$GSINCOSD, and MTH$HSINCOSD return the
sine and cosine of the input angle by reference in the
sine and cosine arguments.
Arguments
angleindegrees
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating, H_floating 
access: 
read only 
mechanism: 
by reference 
Angle (in degrees) whose sine and cosine are returned by MTH$xSINCOSD.
The angleindegrees argument is the address of a
floatingpoint number that is this angle. For MTH$SINCOSD,
angleindegrees is an Ffloating number. For
MTH$DSINCOSD, angleindegrees is a Dfloating number.
For MTH$GSINCOSD, angleindegrees is a Gfloating
number. For MTH$HSINCOSD, angleindegrees is an
Hfloating number.
sine
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating, H_floating 
access: 
write only 
mechanism: 
by reference 
Sine of the angle specified by angleindegrees. The
sine argument is the address of a floatingpoint
number. MTH$SINCOSD writes an Ffloating number into
sine. MTH$DSINCOSD writes a Dfloating number into
sine. MTH$GSINCOSD writes a Gfloating number into
sine. MTH$HSINCOSD writes an Hfloating number into
sine.
cosine
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating, H_floating 
access: 
write only 
mechanism: 
by reference 
Cosine of the angle specified by angleindegrees. The
cosine argument is the address of a floatingpoint
number. MTH$SINCOSD writes an Ffloating number into
cosine. MTH$DSINCOSD writes a Dfloating number into
cosine. MTH$GSINCOSD writes a Gfloating number into
cosine. MTH$HSINCOSD writes an Hfloating number into
cosine.
Description
All routines with JSB entry points accept a single argument in R0:Rm,
where m, which is defined below, is dependent on the data type.
Data Type 
m 
F_floating

0

D_floating

1

G_floating

1

H_floating

3

In general, RunTime Library routines with JSB entry points return one
value in R0:Rm. The MTH$xSINCOSD routine returns two values, however.
The sine of angleindegrees is returned in R0:Rm and
the cosine of angleindegrees is returned in
(R<m+1>:R<2*m+1>).
In degrees, the computation of zSIND(X) and zCOSD(X) is based on the
following polynomial expansions:
SIND(X) = (C*X)  (C*X)^{3}/(3!) +
(C*X)^{5}/(5!)  (C*X)^{7}/(7!) ...
= X/2^{6} + X*P(X^{2}), where
P(y) = y/(3!) + y^{2}/(5!)  y^{3}/(7!) ...
COSD(X) = 1  (C*X)^{2}/(2!) +
(C*X)^{4}/(4!)  (C*X)^{6}/(6!) ...
=Q(X^{2}), where
Q(y) = 1  y/(2!) + y^{2}/(4!)  y^{3}/(6!) ...
and C = Pi sign/180
 If X <(180/Pi sign)*2^{2^e1} and underflow signaling is
enabled,
underflow is signaled for zSIND(X) and zSINCOSD(X).
(See MTH$zCOSH for the definition of e.) otherwise:
 If X < (180/Pi sign)*2^{(f/2)},
then zSIND(X)= (Pi sign/180)*X and zCOSD(X) = 1.
(See MTH$zCOSH for the definition of f.)
 If (180/Pi sign)*2^{(f/2)} <= X < 45
then zSIND(X) = X/2^{6} + P(X^{2})
and zCOSD(X) = Q(X^{2})
 If 45 <= X and X > 0,
 Let J = INT(X/(45)) and
I = J modulo 8
 If J is even, let Y = X  J*45 ;
otherwise, let Y = (J+1)*45  X .
With the above definitions, the following table relates
zSIND(X) and zCOSD(X) to zSIND(Y) and zCOSD(Y):
Value of I 
zSIND(X) 
zCOSD(X) 
0

zSIND(Y)

zCOSD(Y)

1

zCOSD(Y)

zSIND(Y)

2

zCOSD(Y)

zSIND(Y)

3

zSIND(Y)

zCOSD(Y)

4

zSIND(Y)

zCOSD(Y)

5

zCOSD(Y)

zSIND(Y)

6

zCOSD(Y)

zSIND(Y)

7

zSIND(Y)

zCOSD(Y)

 zSIND(Y) and zCOSD(Y) are computed as follows:
zSIND(Y) = Y/2^{6} + P(Y^{2})
zCOSD(Y) = Q(Y^{2})
 If 45 <= X and X < 0,
then zSIND(X) = zSIND(X)
and zCOSD(X) = zCOSD(X)
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$xSINCOSD 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$_FLOUNDMAT

Floatingpoint underflow in Math Library. The absolute value of the
input angle is less than 180/Pi sign*2
^{m} (where m = 128 for Ffloating and Dfloating, 1,024 for
Gfloating, and 16,384 for Hfloating).

MTH$xSIND
The Sine of Angle Expressed in Degrees routine returns the sine of a
given angle (in degrees).
Format
MTH$SIND angleindegrees
MTH$DSIND angleindegrees
MTH$GSIND angleindegrees
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$SIND_R4
MTH$DSIND_R7
MTH$GSIND_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 
The sine of the angle. MTH$SIND returns an Ffloating number. MTH$DSIND
returns a Dfloating number. MTH$GSIND 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 that is this angle. For
MTH$SIND, angleindegrees specifies an Ffloating
number. For MTH$DSIND, angleindegrees specifies a
Dfloating number. For MTH$GSIND, angleindegrees
specifies a Gfloating number.
Description
See MTH$xSINCOSD for the algorithm that is used to compute the sine.
See MTH$HSIND for the description of the Hfloating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$xSIND 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$_FLOUNDMAT

Floatingpoint underflow in Math Library. The absolute value of the
input angle is less than 180/Pi sign*2
^{m} (where m = 128 for Ffloating and Dfloating, and 1,024
for Gfloating).

MTH$xSINH
The Hyperbolic Sine routine returns the hyperbolic sine of the input
value specified by floatingpointinputvalue.
Format
MTH$SINH floatingpointinputvalue
MTH$DSINH floatingpointinputvalue
MTH$GSINH 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 sine of floatingpointinputvalue.
MTH$SINH returns an Ffloating number. MTH$DSINH returns a Dfloating
number. MTH$GSINH 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 a floatingpoint number that is this value.
For MTH$SINH, floatingpointinputvalue specifies an
Ffloating number. For MTH$DSINH,
floatingpointinputvalue specifies a Dfloating
number. For MTH$GSINH, floatingpointinputvalue
specifies a Gfloating number.
Description
Computation of the hyperbolic sine function depends on the magnitude of
the input argument. The range of the function is partitioned using four
data type dependent 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, zSINH(X) is computed as follows:
Value of X 
Value Returned 
X < a(z)

X

a(z)
<= X < 1.0

zSINH(X) is computed using a
power series expansion in X
^{2}

1.0
<= X < b(z)

(zEXP(X)  zEXP(X))/2

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

SIGN(X)*zEXP(X)/2

c(z)
<= X

Overflow occurs

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

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

MTH$_FLOOVEMAT

Floatingpoint overflow in Math Library: the absolute value of
floatingpointinputvalue is greater than
yyy. LIB$SIGNAL copies the floatingpoint reserved operand to
the mechanism argument vector CHF$L_MCH_SAVR0/R1. The result is the
floatingpoint reserved operand unless you have written a condition
handler to change CHF$L_MCH_SAVR0/R1.
The values of
yyy are approximately:
MTH$SINH88.722
MTH$DSINH88.722
MTH$GSINH709.782

