
OpenVMS VAX RTL Mathematics (MTH$) Manual
MTH$HATAND2
Given sine and cosine, the Arc
Tangent in Degrees (HFloating Value) with Two Arguments routine
returns the angle (in degrees) whose tangent is given by the quotient
of sine and cosine
(sine/cosine).
Format
MTH$HATAND2 hdegrees ,sine ,cosine
RETURNS
None.
Arguments
hdegrees
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Angle (in degrees) whose tangent is specified by
(sine/cosine). The
hdegrees argument is the address of an Hfloating
number that is this angle. MTH$HATAND2 writes the address of the angle
into hdegrees.
sine
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
Dividend. The sine argument is the address of a
floatingpoint number that is this dividend. For MTH$HATAND2,
sine specifies an Hfloating number.
cosine
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
Divisor. The cosine argument is the address of a
floatingpoint number that is this divisor. For MTH$HATAND2,
cosine specifies an Hfloating number.
Description
The angle in degrees whose tangent is Y/X is computed
below. The value of f is defined in the description of
MTH$zCOSH.
Value of Input Arguments 
Angle Returned 
X = 0 or Y/X > 2
^{(f+1)}

90* (sign Y)

X > 0 and Y/X
<= 2
^{(f+1)}

zATAND(Y/X)

X
< 0 and Y/X
<= 2
^{(f+1)}

180 * (sign Y) + zATAND(Y/X)

Condition Values Signaled
SS$_ROPRAND

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

Invalid argument. Both
cosine and
sine are zero. 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$HATANH
Given the hyperbolic tangent of an angle, the Hyperbolic Arc Tangent
(HFloating Value) routine returns the hyperbolic arc tangent (as an
Hfloating value) of that angle.
Format
MTH$HATANH hatanh ,hyperbolictangent
RETURNS
None.
Arguments
hatanh
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Hyperbolic arc tangent of the hyperbolic tangent specified by
hyperbolictangent. The hatanh
argument is the address of an Hfloating number that is this hyperbolic
arc tangent. MTH$HATANH writes the address of the hyperbolic arc
tangent into hatanh.
hyperbolictangent
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
Hyperbolic tangent of an angle. The hyperbolictangent
argument is the address of a floatingpoint number that is this
hyperbolic tangent. For MTH$HATANH, hyperbolictangent
specifies an Hfloating number.
Description
The hyperbolic arc tangent function is computed as follows:
Value of x 
Value Returned 
X
< 1

zATANH(X) = zLOG((X+1)/(X1))/2

X => 1

An invalid argument is signaled

Condition Values Signaled
SS$_ROPRAND

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

Invalid argument: X => 1. 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$HCOS
The Cosine of Angle Expressed in Radians (HFloating Value) routine
returns the cosine of a given angle (in radians) as an Hfloating value.
Format
MTH$HCOS hcosine ,angleinradians
Corresponding JSB Entry Point
MTH$HCOS_R5
RETURNS
None.
Arguments
hcosine
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Cosine of the angle specified by angleinradians. The
hcosine argument is the address of an Hfloating
number that is this cosine. MTH$HCOS writes the address of the cosine
into hcosine.
angleinradians
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
Angle (in radians). The angleinradians argument is
the address of a floatingpoint number. For MTH$HCOS,
angleinradians specifies an Hfloating number.
Description
See MTH$xSINCOS for the algorithm used to compute the cosine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$HCOS 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$HCOSD
The Cosine of Angle Expressed in Degrees (HFloating Value) routine
returns the cosine of a given angle (in degrees) as an Hfloating value.
Format
MTH$HCOSD hcosine ,angleindegrees
Corresponding JSB Entry Point
MTH$HCOSD_R5
RETURNS
None.
Arguments
hcosine
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Cosine of the angle specified by angleindegrees. The
hcosine argument is the address of an Hfloating
number that is this cosine. MTH$HCOSD writes this cosine into
hcosine.
angleindegrees
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
Angle (in degrees). The angleindegrees argument is
the address of a floatingpoint number. For MTH$HCOSD,
angleindegrees specifies an Hfloating number.
Description
See the MTH$SINCOSD routine for the algorithm used to compute the
cosine.
Condition Value Signaled
SS$_ROPRAND

Reserved operand. The MTH$HCOSD 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$HCOSH
The Hyperbolic Cosine (HFloating Value) routine returns the hyperbolic
cosine of the input value as an Hfloating value.
Format
MTH$HCOSH hcosh ,floatingpointinputvalue
RETURNS
None.
Arguments
hcosh
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Hyperbolic cosine of the input value specified by
floatingpointinputvalue. The
hcosh argument is the address of an Hfloating number
that is this hyperbolic cosine. MTH$HCOSH writes the address of the
hyperbolic cosine into hcosh.
floatingpointinputvalue
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
The input value. The floatingpointinputvalue
argument is the address of this input value. For MTH$HCOSH,
floatingpointinputvalue specifies an Hfloating
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 as follows: e = 15 f =
113
The values of the constants in terms of e and f are:
Variable 
Value 
a(z)

2
^{f/2}

b(z)

(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

Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$HCOSH 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 value of
yyy is 11356.523.

MTH$HEXP
The Exponential (HFloating Value) routine returns the exponential of
the input value as an Hfloating value.
Format
MTH$HEXP hexp ,floatingpointinputvalue
Corresponding JSB Entry Point
MTH$HEXP_R6
RETURNS
None.
Arguments
hexp
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Exponential of the input value specified by
floatingpointinputvalue. The hexp
argument is the address of an Hfloating number that is this
exponential. MTH$HEXP writes the address of the exponential into
hexp.
floatingpointinputvalue
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
The input value. The floatingpointinputvalue
argument is the address of a floatingpoint number. For MTH$HEXP,
floatingpointinputvalue specifies an Hfloating
number.
Description
The exponential of x is computed as:
Value of x 
Value Returned 
x > c(z)

Overflow occurs

x
<= c(z)

0

x
< 2
^{(f+1)}

1

Otherwise

2
^{Y} * 2
^{U} * 2
^{W}

where: Y = INTEGER(x*ln2(E)) V = FRAC(x*ln2(E)) * 16 U = INTEGER(V)/16
W = FRAC(V)/16 2^{W} = polynomial approximation of degree 14
for z = H.
See also MTH$HCOS for definitions of f and c(z).
Condition Values Signaled
SS$_ROPRAND

Reserved operand. The MTH$HEXP 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:
floatingpointinputvalue is greater than
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 value of
yyy is approximately 11355.830 for MTH$HEXP.

MTH$_FLOUNDMAT

Floatingpoint underflow in Math Library:
floatingpointinputvalue is less than or equal to
yyy and the caller (CALL or JSB) has set hardware
floatingpoint underflow enable. The result is set to 0.0. If the
caller has not enabled floatingpoint underflow (the default), a result
of 0.0 is returned but no error is signaled. The value of
yyy is approximately 11356.523 for MTH$HEXP.

MTH$HLOG
The Natural Logarithm (HFloating Value) routine returns the natural
(base e) logarithm of the input argument as an Hfloating value.
Format
MTH$HLOG hnatlog ,floatingpointinputvalue
Corresponding JSB Entry Point
MTH$HLOG_R8
RETURNS
None.
Arguments
hnatlog
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
Natural logarithm of floatingpointinputvalue. The
hnatlog argument is the address of an Hfloating
number that is this natural logarithm. MTH$HLOG writes the address of
this natural logarithm into hnatlog.
floatingpointinputvalue
OpenVMS usage: 
floating_point 
type: 
H_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$HLOG, floatingpointinputvalue specifies an
Hfloating number.
Description
Computation of the natural logarithm routine is based on the following:
 ln(X*Y) = ln(X) + ln(Y)
 ln(1+X) = X  X^{2}/2 + X^{3}/3  X^{4}/4
...
for X < 1
 ln(X) = ln(A) + 2* (V + V^{3}/3 + V^{5}/5 +
V^{7}/7 ...)
where V = (XA)/(X+A), A > 0,
and p(y) = 2 * (1 + y/3 + y^{2}/5 ...) For x =
2^{n}*f, where n is an integer and f is in the interval of 0.5
to 1, define the following quantities: If n => 1, then N = n1 and
F = 2f If n <= 0, then N = n and F = f From (1) it
follows that:
 ln(X) = N*ln(2) + ln(F)
Based on the previous relationships, zLOG is computed as follows:
 If F1 < 2^{5},
zLOG(X) = N*zLOG(2) + W + W*p(W),
where W = F1.
 Otherwise,
zLOG(X) = N*zLOG(2) + zLOG(A) + V*p(V^{2}),
where V = (FA)/(F+A) and A and zLOG(A)
are obtained by table lookup.
Condition Values Signaled
SS$_ROPRAND

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

Logarithm of zero or negative value. Argument
floatingpointinputvalue is less than or equal to
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.

