|
|
Updated:
12 December 1998
|
OpenVMS VAX RTL Mathematics (MTH$) Manual
MTH$xSQRT
The Square Root routine returns the square root of the input value
floating-point-input-value.
Format
MTH$SQRT floating-point-input-value
MTH$DSQRT floating-point-input-value
MTH$GSQRT floating-point-input-value
Each of the above formats accepts one of the floating-point 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 floating-point
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 floating-point-input-value.
MTH$SQRT returns an F-floating number. MTH$DSQRT returns a D-floating
number. MTH$GSQRT 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 |
Input value. The floating-point-input-value argument
is the address of a floating-point number that contains this input
value. For MTH$SQRT, floating-point-input-value
specifies an F-floating number. For MTH$DSQRT,
floating-point-input-value specifies a D-floating
number. For MTH$GSQRT, floating-point-input-value
specifies a G-floating 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 floating-point data
|
|
F is the fractional part of the floating-point 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 = (K-1)/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] = 2K' * 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 Newton-Raphson iterations are performed:
|
Y[n+1] = 1/2 * (Y[n] + X/Y[n])
|
where n = 2, 3, or 3 for z = F-floating, D-floating, or G-floating,
respectively.
See MTH$HSQRT for the description of the H-floating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND
|
Reserved operand. The MTH$xSQRT 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 Digital.
|
MTH$_SQUROONEG
|
Square root of negative number. Argument
floating-point-input-value is less than 0.0.
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.
|
MTH$xTAN
The Tangent of Angle Expressed in Radians routine returns the tangent
of a given angle (in radians).
Format
MTH$TAN angle-in-radians
MTH$DTAN angle-in-radians
MTH$GTAN angle-in-radians
Each of the above formats accepts one of the floating-point 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 floating-point
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
angle-in-radians. MTH$TAN returns an F-floating
number. MTH$DTAN returns a D-floating number. MTH$GTAN 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 |
The input angle (in radians). The angle-in-radians
argument is the address of a floating-point number that is this angle.
For MTH$TAN, angle-in-radians specifies an F-floating
number. For MTH$DTAN, angle-in-radians specifies a
D-floating number. For MTH$GTAN, angle-in-radians
specifies a G-floating 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 H-floating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND
|
Reserved operand. The MTH$xTAN 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 Digital.
|
MTH$_FLOOVEMAT
|
Floating-point 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 angle-in-degrees
MTH$DTAND angle-in-degrees
MTH$GTAND angle-in-degrees
Each of the above formats accepts one of the floating-point 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 floating-point
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 angle-in-degrees.
MTH$TAND returns an F-floating number. MTH$DTAND returns a D-floating
number. MTH$GTAND 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 |
The input angle (in degrees). The angle-in-degrees
argument is the address of a floating-point number which is this angle.
For MTH$TAND, angle-in-degrees specifies an F-floating
number. For MTH$DTAND, angle-in-degrees specifies a
D-floating number. For MTH$GTAND, angle-in-degrees
specifies a G-floating number.
Description
When the input argument is expressed in degrees, the tangent function
is computed as follows:
- If |X| < (180/Pi sign)*2(-2/(e-1)) 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 H-floating point version of
this routine.
Condition Values Signaled
SS$_ROPRAND
|
Reserved operand. The MTH$xTAND 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 Digital.
|
MTH$_FLOOVEMAT
|
Floating-point overflow in Math Library.
|
MTH$_FLOUNDMAT
|
Floating-point underflow in Math Library.
|
MTH$xTANH
The Compute the Hyperbolic Tangent routine returns the hyperbolic
tangent of the input value.
Format
MTH$TANH floating-point-input-value
MTH$DTANH floating-point-input-value
MTH$GTANH 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 tangent of floating-point-input-value.
MTH$TANH returns an F-floating number. MTH$DTANH returns a D-floating
number. MTH$GTANH 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 contains this
input value. For MTH$TANH, floating-point-input-value
specifies an F-floating number. For MTH$DTANH,
floating-point-input-value specifies a D-floating
number. For MTH$GTANH, floating-point-input-value
specifies a G-floating 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 H-floating point version of
this routine.
Condition Value Signaled
SS$_ROPRAND
|
Reserved operand. The MTH$xTANH 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 Digital.
|
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