next up previous index
Next: M233 Translate Between Up: CERNLIB Previous: M231 Convert Floating-Point

M232 Convert Floating-Point Numbers Between Host Machine and NORD Formats

Routine ID: M232
Author(s): IBM: R. Matthews, CDC: H. RenshallLibrary: KERNLIB, IBM and CDC only
Submitter: Submitted: 01.12. 1980
Language: AssemblerRevised:

OBSOLETE

Please note that this routine has been obsoleted in CNL 219. Users are advised not to use it any longer and to replace it in older programs. No maintenance for it will take place and it will eventually disappear.
Suggested replacement: IE3CONV (M220)

CVTND converts floating point numbers between host machine and NORD formats. Both short (32-bit) and long (48-bit) NORD formats are catered for. Conversion between long NORD format and long (i.e., double-precision) host format is only available on the IBM machines. Conversion between long NORD format and short (i.e., single-precision) host format is only available on the CDC machines. Conversion between short (32-bit) NORD format and short (i.e., single-precision) host format is available on both IBM and CDC.

Structure:

SUBROUTINE package
User Entry Names: LNDLX, LXLND, LNDSX, SXLND, SXSND, SNDSX

Usage:

    CALL LNDLX(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input in the first NWORDS elements NORD long (48-bit) normalised floating point numbers, one per element, right-adjusted with zero-fill. After the call the first NWORDS elements will contain converted normalised DOUBLE PRECISION floating point numbers in the host machine format. This routine is only available on IBM.
NWORDS
( INTEGER) Number of NORD numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL LXLND(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input in the first NWORDS elements DOUBLE PRECISION floating point numbers in the host machine format. After the call the first NWORDS elements will contain converted NORD long (48-bit) floating point numbers, one per element of DWORDS, right-adjusted with zero-fill. This routine is only available on IBM.
NWORDS
( INTEGER) Number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL LNDSX(WORDS,NWORDS)
WORDS
( SINGLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input in the first NWORDS elements NORD long (48-bit) normalised floating point numbers, one per element, right-adjusted with zero-fill. This routine is only available on CDC (60-bit words). After the call the first NWORDS elements will contain converted normalised single-precision floating point numbers in the host machine format.
NWORDS
( INTEGER) Number of NORD numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.

    CALL SXLND(WORDS,NWORDS)
WORDS
( SINGLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input in the first NWORDS elements single-precision floating point numbers in the host machine format. After the call the first NWORDS elements will contain converted NORD long (48-bit) floating point numbers, one per element of WORDS, right-adjusted with zero-fill. This routine is only available on CDC (60-bit words).
NWORDS
( INTEGER) Number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL SNDSX(WORDS,NWORDS)
WORDS
( SINGLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input in the first NWORDS elements NORD short (32-bit) normalised floating point numbers, one per element, right-adjusted with zero-fill (no fill necessary on IBM with 32-bit words). After the call the first NWORDS elements will contain converted normalised single-precision floating point numbers in the host machine format.
NWORDS
( INTEGER) Number of NORD numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL SXSND(WORDS,NWORDS)
WORDS
( SINGLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input in the first NWORDS elements single-precision floating point numbers in the host machine format. After the call the first NWORDS elements will contain converted NORD short (32-bit) floating point numbers, one per element of WORDS, right-adjusted with zero-fill (no fill necessary on IBM with 32-bit words).
NWORDS
( INTEGER) Number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.

Restrictions:

LNDLX and LXLND are available on IBM only.
LNDSX and SXLND are available on CDC only.
SNDSX and SXSND are available on IBM and CDC but require, or generate, the NORD numbers right-adjusted with zero-fill on CDC.

Accuracy:

Precision in the mantissa will be lost by truncation of the least significant bits when converting from a source format to a target format with fewer bits in the mantissa. Note that the mantissa lengths are 23 bits for NORD short, 32 bits for NORD long, 24 bits for IBM short, 56 bits for IBM long and 48 bits for CDC short floating point numbers.

Exponent ranges also differ among the machines. The rule followed on conversion is that when a source machine value is out of range for the target machine the value set is the limiting value for the target machine, i.e. the largest or smallest possible floating point number on that machine. Note that CDC overflow, underflow and indefinite numbers are converted into the largest, smallest and largest possible target NORD numbers respectively. The sign of the source number is preserved during these out-of-range conversions. The exponent ranges are 10-76 to 1076 for NORD short, 10-4920

to 104920 for NORD long, 10-78 to 1076 for IBM short and long and 10-293 to 10322 for CDC short floating point numbers. Hence all long NORD numbers greater than 1076 will be set to 1076 when converted to IBM DOUBLE PRECISION while any CDC numbers smaller than 10-76 would be set to 10-76 when converted to short NORD format.

Notes:

In the calling sequences above S stands for short representation i.e., 32, 32 and 60 bits on NORD, IBM and CDC respectively, while L stands for long representation, i.e,. 48, 64 and 120 bits on NORD, IBM and CDC respectively. The default lengths on IBM and CDC are short. The long forms must be explicitly requested by a DOUBLE PRECISION statement. The character X stands for the host machine and the position of ND and X implies the direction of processing. Hence LNDSX implies convert long NORD format (48-bits) to short host machine format.

M233



next up previous index
Next: M233 Translate Between Up: CERNLIB Previous: M231 Convert Floating-Point


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995