
HP OpenVMS RTL Library (LIB$) Manual
LIB$EMODH
On OpenVMS VAX systems, the Extended Multiply and Integerize routine
(HFloatingPoint Values) allows higherlevel language users to perform
accurate range reduction of Hfloating arguments.
This routine is not available to native OpenVMS Alpha programs but is
available to translated VAX images.
Format
LIB$EMODH floatingpointmultiplier ,multiplierextension
,floatingpointmultiplicand ,integerportion ,fractionalportion
RETURNS
OpenVMS usage: 
cond_value 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Arguments
floatingpointmultiplier
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
The multiplier. The floatingpointmultiplier argument
is an Hfloating number.
multiplierextension
OpenVMS usage: 
word_unsigned 
type: 
word (unsigned) 
access: 
read only 
mechanism: 
by reference 
The leftjustified multiplierextension bits. The
multiplierextension argument is an unsigned word.
floatingpointmultiplicand
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
read only 
mechanism: 
by reference 
The multiplicand. The floatingpointmultiplicand
argument is an Hfloating number.
integerportion
OpenVMS usage: 
longword_signed 
type: 
longword integer (signed) 
access: 
write only 
mechanism: 
by reference 
The integer portion of the result. The integerportion
argument is the address of a signed longword integer containing the
integer portion of the result.
fractionalportion
OpenVMS usage: 
floating_point 
type: 
H_floating 
access: 
write only 
mechanism: 
by reference 
The fractional portion of the result. The
fractionalportion argument is an Hfloating number.
Description
The floatingpoint multiplier extension operand (second operand) is
concatenated with the floatingpoint multiplier (first operand) to gain
x additional loworder fraction bits. The multiplicand is
multiplied by the extended multiplier. After multiplication, the
integer portion is extracted and a ybit floatingpoint number
is formed from the fractional part of the product by truncating extra
bits.
The multiplication yields a result equivalent to the exact product
truncated to a fraction field of y bits. With respect to the
result as the sum of an integer and fraction of the same sign, the
integer operand is replaced by the integer part of the result and the
fraction operand is replaced by the rounded fractional part of the
result.
The values of x and y are as follows:
Routine 
x 
Bits 
y 
LIB$EMODH

15

15:1

128

Condition Values Returned
SS$_NORMAL

Routine successfully completed.

SS$_FLTUND

Floating underflow. The integer and fraction operands are replaced by
zero.

SS$_INTOVF

Integer overflow. The integer operand is replaced by the loworder bits
of the true result. Floating overflow is indicated by SS$_INTOVF also.

SS$_ROPRAND

Reserved operand. The integer and fraction operands are unaffected.

LIB$EMODS (Alpha and I64 Only)
The Extended Multiply and Integerize routine (IEEE SFloatingPoint
Values) allows higherlevel language users to perform accurate range
reduction of IEEE Sfloating arguments.
Format
LIB$EMODS floatingpointmultiplier ,multiplierextension
,floatingpointmultiplicand ,integerportion ,fractionalportion
RETURNS
OpenVMS usage: 
cond_value 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Arguments
floatingpointmultiplier
OpenVMS usage: 
floating_point 
type: 
IEEE S_floating 
access: 
read only 
mechanism: 
by reference 
The multiplier. The floatingpointmultiplier argument
is the address of an IEEE Sfloating number containing the number.
multiplierextension
OpenVMS usage: 
byte_unsigned 
type: 
byte (unsigned) 
access: 
read only 
mechanism: 
by reference 
The leftjustified multiplierextension bits. The
multiplierextension argument is the address of an
unsigned byte containing these multiplier extension bits.
floatingpointmultiplicand
OpenVMS usage: 
floating_point 
type: 
IEEE S_floating 
access: 
read only 
mechanism: 
by reference 
The multiplicand. The floatingpointmultiplicand
argument is an IEEE Sfloating number.
integerportion
OpenVMS usage: 
longword_signed 
type: 
longword (signed) 
access: 
write only 
mechanism: 
by reference 
The integer portion of the result. The integerportion
argument is the address of a signed longword integer containing the
integer portion of the result.
fractionalportion
OpenVMS usage: 
floating_point 
type: 
IEEE S_floating 
access: 
write only 
mechanism: 
by reference 
The fractional portion of the result. The
fractionalportion argument is the address of an IEEE
Sfloating number containing the fractional portion of the result.
Description
LIB$EMODS allows higherlevel language users to perform accurate range
reduction of IEEE Sfloating arguments.
The floatingpoint multiplierextension operand
(second operand) is concatenated with the
floatingpointmultiplier (first operand) to gain
x additional loworder fraction bits. The multiplicand is
multiplied by the extended multiplier. After multiplication, the
integer portion is extracted and a ybit floatingpoint number
is formed from the fractional part of the product by truncating extra
bits.
The multiplication yields a result equivalent to the exact product
truncated to a fraction field of y bits. With respect to the
result as the sum of an integer and fraction of the same sign, the
integer operand is replaced by the integer part of the result and the
fraction operand is replaced by the rounded fractional part of the
result.
The values of x and y are as follows:
Routine 
x 
Bits 
y 
LIB$EMODS

8

7:0

32

Condition Values Returned
SS$_NORMAL

Routine successfully completed.

SS$_FLTUND

Floating underflow. The integer and fraction operands are replaced by
zero.

SS$_INTOVF

Integer overflow. The integer operand is replaced by the loworder bits
of the true result. Floating overflow is indicated by SS$_INTOVF also.

SS$_ROPRAND

Reserved operand. The integer and fraction operands are unaffected.

LIB$EMODT (Alpha and I64 Only)
The Extended Multiply and Integerize routine (IEEE TFloatingPoint
Values) allows higherlevel language users to perform accurate range
reduction of IEEE Tfloating arguments.
Format
LIB$EMODT floatingpointmultiplier ,multiplierextension
,floatingpointmultiplicand ,integerportion ,fractionalportion
RETURNS
OpenVMS usage: 
cond_value 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Arguments
floatingpointmultiplier
OpenVMS usage: 
floating_point 
type: 
IEEE T_floating 
access: 
read only 
mechanism: 
by reference 
The multiplier. The floatingpointmultiplier argument
is the address of an IEEE Tfloating number containing the number.
multiplierextension
OpenVMS usage: 
byte_unsigned 
type: 
byte (unsigned) 
access: 
read only 
mechanism: 
by reference 
The leftjustified multiplierextension bits. The
multiplierextension argument is the address of an
unsigned byte containing these multiplier extension bits.
floatingpointmultiplicand
OpenVMS usage: 
floating_point 
type: 
IEEE T_floating 
access: 
read only 
mechanism: 
by reference 
The multiplicand. The floatingpointmultiplicand
argument is an IEEE Tfloating number.
integerportion
OpenVMS usage: 
longword_signed 
type: 
longword (signed) 
access: 
write only 
mechanism: 
by reference 
The integer portion of the result. The integerportion
argument is the address of a signed longword integer containing the
integer portion of the result.
fractionalportion
OpenVMS usage: 
floating_point 
type: 
IEEE T_floating 
access: 
write only 
mechanism: 
by reference 
The fractional portion of the result. The
fractionalportion argument is the address of an IEEE
Tfloating number containing the fractional portion of the result.
Description
LIB$EMODT allows higherlevel language users to perform accurate range
reduction of IEEE Tfloating arguments.
The floatingpoint multiplierextension operand
(second operand) is concatenated with the
floatingpointmultiplier (first operand) to gain
x additional loworder fraction bits. The multiplicand is
multiplied by the extended multiplier. After multiplication, the
integer portion is extracted and a ybit floatingpoint number
is formed from the fractional part of the product by truncating extra
bits.
The multiplication yields a result equivalent to the exact product
truncated to a fraction field of y bits. With respect to the
result as the sum of an integer and fraction of the same sign, the
integer operand is replaced by the integer part of the result and the
fraction operand is replaced by the rounded fractional part of the
result.
The values of x and y are as follows:
Routine 
x 
Bits 
y 
LIB$EMODT

11

11:0

64

Condition Values Returned
SS$_NORMAL

Routine successfully completed.

SS$_FLTUND

Floating underflow. The integer and fraction operands are replaced by
zero.

SS$_INTOVF

Integer overflow. The integer operand is replaced by the loworder bits
of the true result. Floating overflow is indicated by SS$_INTOVF also.

SS$_ROPRAND

Reserved operand. The integer and fraction operands are unaffected.

LIB$EMUL
The ExtendedPrecision Multiply routine performs extendedprecision
multiplication. LIB$EMUL makes the VAX EMUL instruction available as a
callable routine.
Note
On Alpha and I64 systems, OpenVMS Alpha and I64 instructions perform
the equivalent operation.

Format
LIB$EMUL longwordintegermultiplier ,longwordintegermultiplicand
,addend ,product
RETURNS
OpenVMS usage: 
cond_value 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Arguments
longwordintegermultiplier
OpenVMS usage: 
longword_signed 
type: 
longword integer (signed) 
access: 
read only 
mechanism: 
by reference 
Multiplier used by LIB$EMUL in the extendedprecision multiplication.
The longwordintegermultiplier argument is the
address of a signed longword integer containing the multiplier.
longwordintegermultiplicand
OpenVMS usage: 
longword_signed 
type: 
longword integer (signed) 
access: 
read only 
mechanism: 
by reference 
Multiplicand used by LIB$EMUL in the extendedprecision multiplication.
The longwordintegermultiplicand argument is the
address of a signed longword integer containing the multiplicand.
addend
OpenVMS usage: 
longword_signed 
type: 
longword integer (signed) 
access: 
read only 
mechanism: 
by reference 
Addend used by LIB$EMUL in the extendedprecision multiplication. The
addend argument is the address of a signed longword
integer containing the addend.
product
OpenVMS usage: 
quadword_signed 
type: 
quadword integer (signed) 
access: 
write only 
mechanism: 
by reference 
Product of the extendedprecision multiplication. The
product argument is the address of a signed quadword
integer into which LIB$EMUL writes the product.
Description
The multiplicand argument is multiplied by the multiplier argument
giving a doublelength result. The addend argument is signextended to
doublelength and added to the result. LIB$EMUL then writes the result
into the product argument.
Condition Values Returned
SS$_NORMAL

Routine successfully completed.



Example

INTEGER MULT1,MULT2,ADDEND,PRODUCT(2)
C+
C Find the extended precision multiplication of 268435456 times 4096.
C That is, find the extended precision product of 2**28 times 2**12.
C Since 268435456 times 4096 is 2**40, a quadword value is needed for
C the calculation: use LIB$EMUL.
C
MULT1 = 4096
MULT2 = 268435456
APPEND = 0
C+
C Compute 268435456*4096.
C Note that product will be stored as a quadword. This value will be stored
C in the 2 dimensional vector PRODUCT. The first element of PRODUCT will
C contain the low order bits, while the second element will contain the high
C order bits.
C
RETURN = LIB$EMUL(MULT1,MULT2,APPEND,PRODUCT)
TYPE *,'PRODUCT(2) =',PRODUCT(2),' and PRODUCT(1) = ',PRODUCT(1)
TYPE *,' '
TYPE *,'Note that 256 and 0 represent the hexadecimal value'
type *,14H'10000000000'x,', which in turn, represents 2**40.'
END

This Fortran program demonstrates how to use LIB$EMUL. The output
generated by this program is as follows:
PRODUCT(2) = 256 and PRODUCT(1) = 0

Note that 256 and 0 represent the hexadecimal value '10000000000'x,
which in turn represents 2^{40}.
LIB$ENABLE_CTRL
The Enable CLI Interception of Control Characters routine requests the
calling process's command language interpreter (CLI) to resume
interception of the selected control characters when they are typed
during an interactive terminal session. LIB$ENABLE_CTRL provides the
same function as the DCL command SET CONTROL.
Format
LIB$ENABLE_CTRL enablemask [,oldmask]
RETURNS
OpenVMS usage: 
cond_value 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by value 
Arguments
enablemask
OpenVMS usage: 
mask_longword 
type: 
longword (unsigned) 
access: 
read only 
mechanism: 
by reference 
Bit mask indicating for which control characters LIB$ENABLE_CTRL is to
enable interception. The enablemask argument is the
address of an unsigned longword containing this bit mask. Each of the
32 bits corresponds to one of the 32 possible control characters. If a
bit is set, the corresponding control character is intercepted by the
CLI. Currently, only bits 20 and 25, corresponding to Ctrl/T and
Ctrl/Y, are recognized.
The following mask is defined in symbol libraries supplied by HP to
specify the value of enablemask:
Symbol 
Hex Value 
Function 
LIB$M_CLI_CTRLT

%X'00100000'

Enables Ctrl/T

LIB$M_CLI_CTRLY

%X'02000000'

Enables Ctrl/Y

If a set bit does not correspond to a character that the CLI can
intercept, an error is returned.
oldmask
OpenVMS usage: 
mask_longword 
type: 
longword (unsigned) 
access: 
write only 
mechanism: 
by reference 
Previous bit mask. The oldmask argument is the
address of an unsigned longword containing the old bit mask. The old
bit mask is of the same form as enablemask.
Description
LIB$ENABLE_CTRL provides the functions of the DCL command SET CONTROL.
Normally, Ctrl/Y interrupts the current command, command procedure, or
image. After a call to LIB$DISABLE_CTRL, Ctrl/Y is treated like Ctrl/U
followed by a carriage return. LIB$ENABLE_CTRL restores the normal
operation of Ctrl/Y or Ctrl/T.
Both the DCL and MCR CLIs can intercept control characters. See the
HP OpenVMS DCL Dictionary for information on how the CLI processes control
characters.
LIB$ENABLE_CTRL is supported for use with the DCL or MCR CLIs.
If an image is run directly as a subprocess or as a detached process,
there is no CLI present to perform this function. In those cases, the
error status LIB$_NOCLI is returned.
Condition Values Returned
SS$_NORMAL

Routine successfully completed.

LIB$_INVARG

Invalid argument. A bit in
enablemask was set which did not correspond to a
control character supported by the CLI.

LIB$_NOCLI

No CLI present. The calling process did not have a CLI to perform the
function, or the CLI did not support the request type. Note that an
image run as a subprocess or detached process does not have a CLI.

LIB$_UNECLIERR

Unexpected CLI error. The CLI returned an error status which was not
recognized. This error may be caused by use of a nonstandard CLI. If
this error occurs while using the DCL or MCR CLIs, please report the
problem to your HP support representative.

