
OpenVMS VAX RTL Mathematics (MTH$) Manual
MTH$xSQRT
The Square Root routine returns the square root of the input value
floatingpointinputvalue.
Format
MTH$SQRT floatingpointinputvalue
MTH$DSQRT floatingpointinputvalue
MTH$GSQRT floatingpointinputvalue
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$SQRT_R3
MTH$DSQRT_R5
MTH$GSQRT_R5
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 square root of floatingpointinputvalue.
MTH$SQRT returns an Ffloating number. MTH$DSQRT returns a Dfloating
number. MTH$GSQRT returns a Gfloating number.
Argument
floatingpointinputvalue
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
Input value. The floatingpointinputvalue argument
is the address of a floatingpoint number that contains this input
value. For MTH$SQRT, floatingpointinputvalue
specifies an Ffloating number. For MTH$DSQRT,
floatingpointinputvalue specifies a Dfloating
number. For MTH$GSQRT, floatingpointinputvalue
specifies a Gfloating number.
Description
The square root of X is computed as follows:

If X
< 0 , an error is signaled.


Let X = 2
^{K} * F


where:


K is the exponential part of the floatingpoint data


F is the fractional part of the floatingpoint data


If K is even:
X = 2
^{(2*P)} * F,
zSQRT(X) = 2
^{P} * zSQRT(F),
1/2
<= F
< 1 , where P = K/2


If K is odd:
X = 2
^{(2*P+1)} * F = 2
^{(2*P+2)} * (F/2),
zSQRT(X) = 2
^{(P+1)} * zSQRT(F/2),
1/4
<= F/2
< 1/2 , where p = (K1)/2


Let F' = A*F + B, when K is even:


A = 0.95F6198 (hex)


B = 0.6BA5918 (hex)


Let F' = A* (F/2) + B, when K is odd:


A = 0.D413CCC (hex)


B = 0.4C1E248 (hex)


Let K' = P, when K is even


Let K' = P+1, when K is odd

Let Y[0] = 2^{K'} * F' be a straight line approximation within
the given interval using coefficients A and B which minimize the
absolute error at the midpoint and endpoint.
Starting with Y[0], n NewtonRaphson iterations are performed:

Y[n+1] = 1/2 * (Y[n] + X/Y[n])

where n = 2, 3, or 3 for z = Ffloating, Dfloating, or Gfloating,
respectively.
See MTH$HSQRT for the description of the Hfloating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$xSQRT 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$_SQUROONEG

Square root of negative number. Argument
floatingpointinputvalue is less than 0.0.
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.

MTH$xTAN
The Tangent of Angle Expressed in Radians routine returns the tangent
of a given angle (in radians).
Format
MTH$TAN angleinradians
MTH$DTAN angleinradians
MTH$GTAN angleinradians
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$TAN_R4
MTH$DTAN_R7
MTH$GTAN_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 tangent of the angle specified by
angleinradians. MTH$TAN returns an Ffloating
number. MTH$DTAN returns a Dfloating number. MTH$GTAN returns a
Gfloating number.
Argument
angleinradians
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
The input angle (in radians). The angleinradians
argument is the address of a floatingpoint number that is this angle.
For MTH$TAN, angleinradians specifies an Ffloating
number. For MTH$DTAN, angleinradians specifies a
Dfloating number. For MTH$GTAN, angleinradians
specifies a Gfloating number.
Description
When the input argument is expressed in radians, the tangent function
is computed as follows:
 If X < 2^{(f/2)} , then zTAN(X) = X (see the section on
MTH$zCOSH for the definition of f)
 Otherwise, call MTH$zSINCOS to obtain zSIN(X) and zCOS(X); then
 If zCOS(X) = 0 , signal overflow
 Otherwise, zTAN(X) = zSIN(X)/zCOS(X)
See MTH$HTAN for the description of the Hfloating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND

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

MTH$xTAND
The Tangent of Angle Expressed in Degrees routine returns the tangent
of a given angle (in degrees).
Format
MTH$TAND angleindegrees
MTH$DTAND angleindegrees
MTH$GTAND angleindegrees
Each of the above formats accepts one of the floatingpoint types as
input. Corresponding JSB Entry Points
MTH$TAND_R4
MTH$DTAND_R7
MTH$GTAND_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 
Tangent of the angle specified by angleindegrees.
MTH$TAND returns an Ffloating number. MTH$DTAND returns a Dfloating
number. MTH$GTAND returns a Gfloating number.
Argument
angleindegrees
OpenVMS usage: 
floating_point 
type: 
F_floating, D_floating, G_floating 
access: 
read only 
mechanism: 
by reference 
The input angle (in degrees). The angleindegrees
argument is the address of a floatingpoint number which is this angle.
For MTH$TAND, angleindegrees specifies an Ffloating
number. For MTH$DTAND, angleindegrees specifies a
Dfloating number. For MTH$GTAND, angleindegrees
specifies a Gfloating number.
Description
When the input argument is expressed in degrees, the tangent function
is computed as follows:
 If X < (180/Pi sign)*2^{(2/(e1))} and underflow
signaling is enabled, underflow is signaled. (See the section on
MTH$zCOSH for the definition of e.)
 Otherwise, if X < (180/Pi sign)*2^{(f/2)}, then zTAND(X)
= (Pi sign/180)*X. (See the description of MTH$zCOSH for the definition
of f.)
 Otherwise, call MTH$zSINCOSD to obtain zSIND(X) and zCOSD(X).
 Then, if zCOSD(X) = 0 , signal overflow
 Else, zTAND(X) = zSIND(X)/zCOSD(X)
See MTH$HTAND for the description of the Hfloating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND

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

MTH$_FLOUNDMAT

Floatingpoint underflow in Math Library.

MTH$xTANH
The Compute the Hyperbolic Tangent routine returns the hyperbolic
tangent of the input value.
Format
MTH$TANH floatingpointinputvalue
MTH$DTANH floatingpointinputvalue
MTH$GTANH 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 tangent of floatingpointinputvalue.
MTH$TANH returns an Ffloating number. MTH$DTANH returns a Dfloating
number. MTH$GTANH 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 contains this
input value. For MTH$TANH, floatingpointinputvalue
specifies an Ffloating number. For MTH$DTANH,
floatingpointinputvalue specifies a Dfloating
number. For MTH$GTANH, floatingpointinputvalue
specifies a Gfloating number.
Description
In calculating the hyperbolic tangent of x, the values of
g and h are:
z 
g 
h 
F

12

10

D

28

21

G

26

20

For MTH$TANH, MTH$DTANH, and MTH$GTANH the hyperbolic tangent of
x is then computed as follows:
Value of x 
Hyperbolic Tangent Returned 
x
<= 2
^{g}

X

2
^{g}
< X
< 0.5

xTANH(X) = X + X
^{3} * R(X
^{2}), where R(X
^{2}) is a rational function of X
^{2} .

0.5
<= X
< 1.0

xTANH(X) = xTANH(xHI) + xTANH(xLO)*C/B


where C = 1  xTANH(xHI)*xTANH(xHI),


B = 1 + xTANH(xHI)*xTANH(xLO),


xHI = 1/2 + N/16 + 1/32 for N=0,1,...,7,


and xLO = X  xHI.

1.0
< X
< h

xTANH(X) = (xEXP(2*X)  1)/(xEXP(2*X) + 1)

h
<= X

xTANH(X) = sign(X) *1

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

Reserved operand. The MTH$xTANH 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$UMAX
The Compute Unsigned Maximum routine computes the unsigned longword
maximum of n unsigned longword arguments, where n is
greater than or equal to 1.
Format
MTH$UMAX argument [argument,...]
RETURNS
OpenVMS usage: 
longword_unsigned 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Maximum value returned by MTH$UMAX.
Arguments
argument
OpenVMS usage: 
longword_unsigned 
type: 
longword (unsigned) 
access: 
read only 
mechanism: 
by reference 
Argument whose maximum MTH$UMAX computes. Each
argument argument is an unsigned longword that
contains one of these values.
argument
OpenVMS usage: 
longword_unsigned 
type: 
longword (unsigned) 
access: 
read only 
mechanism: 
by reference 
Additional arguments whose maximum MTH$UMAX computes. Each
argument argument is an unsigned longword that
contains one of these values.
Description
MTH$UMAX is the unsigned version of MTH$JMAX0, and computes the
unsigned longword maximum of n unsigned longword arguments,
where n is greater than or equal to 1.
Condition Values Returned
MTH$UMIN
The Compute Unsigned Minimum routine computes the unsigned longword
minimum of n unsigned longword arguments, where n is
greater than or equal to 1.
Format
MTH$UMIN argument [argument,...]
RETURNS
OpenVMS usage: 
longword_unsigned 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Minimum value returned by MTH$UMIN.
Arguments
argument
OpenVMS usage: 
longword_unsigned 
type: 
longword (unsigned) 
access: 
read only 
mechanism: 
by reference 
Argument whose minimum MTH$UMIN computes. Each
argument argument is an unsigned longword that
contains one of these values.
argument
OpenVMS usage: 
longword_unsigned 
type: 
longword (unsigned) 
access: 
read only 
mechanism: 
by reference 
Additional arguments whose minimum MTH$UMIN computes. Each
argument argument is an unsigned longword that
contains one of these values.
Description
MTH$UMIN is the unsigned version of MTH$JMIN0, and computes the
unsigned longword minimum of n unsigned longword arguments,
where n is greater than or equal to 1.
Condition Values Returned
