Document revision date: 30 March 2001
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

OpenVMS VAX RTL Mathematics (MTH$) Manual


Previous Contents Index


MTH$xSIN

The Sine of Angle Expressed in Radians routine returns the sine of a given angle (in radians).

Format

MTH$SIN angle-in-radians

MTH$DSIN angle-in-radians

MTH$GSIN angle-in-radians

Each of the above formats accepts one of the floating-point 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 floating-point 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 angle-in-radians. MTH$SIN returns an F-floating number. MTH$DSIN returns a D-floating number. MTH$GSIN returns a G-floating number.


Argument

angle-in-radians


OpenVMS usage: floating_point
type: F_floating, D_floating, G_floating
access: read only
mechanism: by reference

Angle (in radians). The angle-in-radians argument is the address of a floating-point number that is this angle. For MTH$SIN, angle-in-radians specifies an F-floating number. For MTH$DSIN, angle-in-radians specifies a D-floating number. For MTH$GSIN, angle-in-radians specifies a G-floating number.

Description

See MTH$xSINCOS for the algorithm used to compute this sine.

See MTH$HSIN for the description of the H-floating point version of this routine.


Condition Value Signaled

SS$_ROPRAND Reserved operand. The MTH$xSIN routine encountered a floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point 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 angle-in-radians ,sine ,cosine

MTH$DSINCOS angle-in-radians ,sine ,cosine

MTH$GSINCOS angle-in-radians ,sine ,cosine

MTH$HSINCOS angle-in-radians ,sine ,cosine

Each of the above formats accepts one of the floating-point 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 floating-point 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

angle-in-radians


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 angle-in-radians argument is the address of a floating-point number that is this angle. For MTH$SINCOS, angle-in-radians is an F-floating number. For MTH$DSINCOS, angle-in-radians is a D-floating number. For MTH$GSINCOS, angle-in-radians is a G-floating number. For MTH$HSINCOS, angle-in-radians is an H-floating 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 angle-in-radians. The sine argument is the address of a floating-point number. MTH$SINCOS writes an F-floating number into sine. MTH$DSINCOS writes a D-floating number into sine. MTH$GSINCOS writes a G-floating number into sine. MTH$HSINCOS writes an H-floating 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 angle-in-radians. The cosine argument is the address of a floating-point number. MTH$SINCOS writes an F-floating number into cosine. MTH$DSINCOS writes a D-floating number into cosine. MTH$GSINCOS writes a G-floating number into cosine. MTH$HSINCOS writes an H-floating 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, Run-Time Library routines with JSB entry points return one value in R0:Rm. The MTHxSINCOS routine returns two values, however. The sine of angle-in-radians is returned in R0:Rm and the cosine of angle-in-radians 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 - X3/(3!) + X5/(5!) - X7/(7!) ...
=X + X*P(X2), where
P(y) = y/(3!) + y2/(5!) + y3/(7!) ...

cos(X) = 1 - X2/(2!) + x4/(4!) -X6/(6!) ...
=Q(X2), where
Q(y) = (1 - y/(2!) + y2/(4!) + y3/(6!) ...)
  1. If |X| < 2 (-f/2),
    then zSIN(X) = X and zCOS(X) = 1
    (see the section on MTH$zCOSH for
    the definition of f)
  2. If 2-f/2 <= |X| < Pi sign/4,
    then zSIN(X) = X + P(X2)
    and zCOS(X) = Q(X2)

  3. If Pi sign/4 <= |X| and X > 0,
    1. Let J = INT(X/(Pi sign/4))
      and I = J modulo 8
    2. 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)
    3. zSIN(Y) and zCOS(Y) are computed as follows:
      zSIN(Y) = Y + P(Y2),
      and zCOS(Y) = Q(Y2)
  4. 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 floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point 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 angle-in-degrees ,sine ,cosine

MTH$DSINCOSD angle-in-degrees ,sine ,cosine

MTH$GSINCOSD angle-in-degrees ,sine ,cosine

MTH$HSINCOSD angle-in-degrees ,sine ,cosine

Each of the above formats accepts one of the floating-point 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 floating-point 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

angle-in-degrees


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 angle-in-degrees argument is the address of a floating-point number that is this angle. For MTH$SINCOSD, angle-in-degrees is an F-floating number. For MTH$DSINCOSD, angle-in-degrees is a D-floating number. For MTH$GSINCOSD, angle-in-degrees is a G-floating number. For MTH$HSINCOSD, angle-in-degrees is an H-floating 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 angle-in-degrees. The sine argument is the address of a floating-point number. MTH$SINCOSD writes an F-floating number into sine. MTH$DSINCOSD writes a D-floating number into sine. MTH$GSINCOSD writes a G-floating number into sine. MTH$HSINCOSD writes an H-floating 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 angle-in-degrees. The cosine argument is the address of a floating-point number. MTH$SINCOSD writes an F-floating number into cosine. MTH$DSINCOSD writes a D-floating number into cosine. MTH$GSINCOSD writes a G-floating number into cosine. MTH$HSINCOSD writes an H-floating 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, Run-Time Library routines with JSB entry points return one value in R0:Rm. The MTH$xSINCOSD routine returns two values, however. The sine of angle-in-degrees is returned in R0:Rm and the cosine of angle-in-degrees 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/26 + X*P(X2), where
P(y) = -y/(3!) + y2/(5!) - y3/(7!) ...

COSD(X) = 1 - (C*X)2/(2!) +
(C*X)4/(4!) - (C*X)6/(6!) ...
=Q(X2), where
Q(y) = 1 - y/(2!) + y2/(4!) - y3/(6!) ...
and C = Pi sign/180
  1. If |X| <(180/Pi sign)*2-2^e-1 and underflow signaling is enabled,
    underflow is signaled for zSIND(X) and zSINCOSD(X).
    (See MTH$zCOSH for the definition of e.)
    otherwise:
  2. 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.)
  3. If (180/Pi sign)*2(-f/2) <= |X| < 45
    then zSIND(X) = X/26 + P(X2)
    and zCOSD(X) = Q(X2)
  4. If 45 <= |X| and X > 0,
    1. Let J = INT(X/(45)) and
      I = J modulo 8
    2. 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)
    3. zSIND(Y) and zCOSD(Y) are computed as follows:
      zSIND(Y) = Y/26 + P(Y2)
      zCOSD(Y) = Q(Y2)
    4. 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 floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Compaq.
MTH$_FLOUNDMAT Floating-point underflow in Math Library. The absolute value of the input angle is less than 180/Pi sign*2 -m (where m = 128 for F-floating and D-floating, 1,024 for G-floating, and 16,384 for H-floating).

MTH$xSIND

The Sine of Angle Expressed in Degrees routine returns the sine of a given angle (in degrees).

Format

MTH$SIND angle-in-degrees

MTH$DSIND angle-in-degrees

MTH$GSIND angle-in-degrees

Each of the above formats accepts one of the floating-point 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 floating-point 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 F-floating number. MTH$DSIND returns a D-floating number. MTH$GSIND returns a G-floating number.


Argument

angle-in-degrees


OpenVMS usage: floating_point
type: F_floating, D_floating, G_floating
access: read only
mechanism: by reference

Angle (in degrees). The angle-in-degrees argument is the address of a floating-point number that is this angle. For MTH$SIND, angle-in-degrees specifies an F-floating number. For MTH$DSIND, angle-in-degrees specifies a D-floating number. For MTH$GSIND, angle-in-degrees specifies a G-floating number.

Description

See MTH$xSINCOSD for the algorithm that is used to compute the sine.

See MTH$HSIND for the description of the H-floating point version of this routine.


Condition Values Signaled

SS$_ROPRAND Reserved operand. The MTH$xSIND routine encountered a floating-point reserved operand due to incorrect user input. A floating-point reserved operand is a floating-point datum with a sign bit of 1 and a biased exponent of 0. Floating-point reserved operands are reserved for future use by Compaq.
MTH$_FLOUNDMAT Floating-point underflow in Math Library. The absolute value of the input angle is less than 180/Pi sign*2 -m (where m = 128 for F-floating and D-floating, and 1,024 for G-floating).

MTH$xSINH

The Hyperbolic Sine routine returns the hyperbolic sine of the input value specified by floating-point-input-value.

Format

MTH$SINH floating-point-input-value

MTH$DSINH floating-point-input-value

MTH$GSINH floating-point-input-value

Each of the above formats accepts one of the floating-point 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 floating-point-input-value. MTH$SINH returns an F-floating number. MTH$DSINH returns a D-floating number. MTH$GSINH returns a G-floating number.


Argument

floating-point-input-value


OpenVMS usage: floating_point
type: F_floating, D_floating, G_floating
access: read only
mechanism: by reference

The input value. The floating-point-input-value argument is the address of a floating-point number that is this value. For MTH$SINH, floating-point-input-value specifies an F-floating number. For MTH$DSINH, floating-point-input-value specifies a D-floating number. For MTH$GSINH, floating-point-input-value specifies a G-floating 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 (e-1)*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 H-floating point version of this routine.


Condition Values Signaled

SS$_ROPRAND Reserved operand. The MTH$HTANH routine encountered a floating-point reserved operand (a floating-point datum with a sign bit of 1 and a biased exponent of 0) due to incorrect user input. Floating-point reserved operands are reserved for use by Compaq.
MTH$_FLOOVEMAT Floating-point overflow in Math Library: the absolute value of floating-point-input-value is greater than yyy. LIB$SIGNAL copies the floating-point reserved operand to the mechanism argument vector CHF$L_MCH_SAVR0/R1. The result is the floating-point reserved operand unless you have written a condition handler to change CHF$L_MCH_SAVR0/R1.

The values of yyy are approximately:

MTH$SINH---88.722
MTH$DSINH---88.722
MTH$GSINH---709.782


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
6117PRO_013.HTML