next up previous index
Next: M220 Conversion To Up: CERNLIB Previous: M215 Find Power-of-Ten

M218 Convert Between CDC and IBM Floating-Point Number Formats

Routine ID: M218
Author(s): F. CarminatiLibrary: KERNLIB, IBM only
Submitter: Submitted: 05.10.1986
Language: FortranRevised:

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)

CVTCDC converts floating point numbers between host machine and CDC formats. Both Short (60-bit) and Long (120-bit) CDC formats are catered for.

Structure:

SUBROUTINE subprograms
User Entry Names:
SCDDX, SCDSX, SXDCD, SXSCD
DCDDX, DCDSX, DXDCD, DXSCD

Usage:

    CALL SCDDX(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input CDC short (60-bit) normalised floating point numbers, stored in the elements of DWORDS, 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) Constant or variable containing on input the number of CDC numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL DXSCD(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 CDC SINGLE PRECISION (60-bit) floating point numbers, in the elements of DWORDS, right-adjusted with zero-fill. This routine is only available on IBM.
NWORDS
( INTEGER) Constant or variable containing on input the number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL DCDSX(DWORDS,NWORDS)
DWORDS
( SINGLE PRECISION) Array dimensioned to at least 4*NWORDS in the calling program and containing on input CDC long (120-bit) normalised floating point numbers, stored in 2 consecutive pairs of elements of DWORDS, 60 bits in each pair, right-adjusted with zero-fill. After the call the first NWORDS elements will contain converted normalised SINGLE PRECISION floating point numbers in the host machine format. This routine is only available on IBM.
NWORDS
( INTEGER) Constant or variable containing on input the number of CDC numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.

    CALL SXDCD(DWORDS,NWORDS)
DWORDS
( SINGLE PRECISION) Array dimensioned to at least 4*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 4*NWORDS elements will contain converted CDC DOUBLE PRECISION (120-bit) floating point numbers, each in 2 consecutive pairs of elements of DWORDS, 60 bits per pair, right-adjusted with zero-fill. This routine is only available on IBM.
NWORDS
( INTEGER) Constant or variable containing on input the number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL DCDDX(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least 2*NWORDS in the calling program and containing on input CDC long (120-bit) normalised floating point numbers, stored in consecutive pairs of elements of DWORDS, 60 bits 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) Constant or variable containing on input the number of CDC numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL DXDCD(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least 2*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 2*NWORDS elements will contain converted CDC DOUBLE PRECISION (120-bit) floating point numbers in each pair of consecutive elements of DWORDS, 60 bits per element, right-adjusted with zero-fill. This routine is only available on IBM.
NWORDS
( INTEGER) Constant or variable containing on input the number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL SCDSX(DWORDS,NWORDS)
DWORDS
( SINGLE PRECISION) array dimensioned to at least 2*NWORDS in the calling program and containing on input CDC short (60-bit) normalised floating point numbers, stored in two consecutive elements of DWORDS right-adjusted with zero-fill. After the call the first NWORDS elements will contain converted normalised SINGLE PRECISION floating point numbers in the host machine format. This routine is only available on IBM.
NWORDS
( INTEGER) constant or variable containing on input the number of CDC numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL SXSCD(DWORDS,NWORDS)
DWORDS
( SINGLE PRECISION) Array dimensioned to at least 2*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 2*NWORDS elements will contain converted CDC SINGLE PRECISION (60-bit) floating point numbers, in two consecutive elements of DWORDS right-adjusted with zero-fill. This routine is only available on IBM.
NWORDS
( INTEGER) Constant or variable containing on input the number of host numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.

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 48 bits for CDC short, 96 bits for CDC long, 24 bits for IBM short, 56 bits for IBM long.

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 IBM numbers respectively. The sign of the source number is preserved during these out-of-range conversions. The exponent ranges are 10-78 to 1076 for IBM short and long and 10-293 to 10322 for CDC short floating point numbers. Hence all CDC numbers greater than 1076 will be set to 1076 when converted to IBM DOUBLE and SINGLE PRECISION while any CDC numbers smaller than 10-78 would be set to 10-78 when converted to IBM format.

Notes:

In the calling sequences above S stands for short representation i.e., 32 and 60 bits on IBM and CDC respectively, while D stands for long representation, i.e., 64 and 120 bits 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. X stands for the host machine and the position of CD and X implies the direction of processing. Hence DCDSX implies convert long CDC format (120-bits) to short host machine format.

M220



next up previous index
Next: M220 Conversion To Up: CERNLIB Previous: M215 Find Power-of-Ten


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