next up previous index
Next: M215 Find Power-of-Ten Up: CERNLIB Previous: M109 Sort Rows

M214 Conversion To and From VAX Number Formats on IBM

Routine ID: M214
Author(s): F. CarminatiLibrary: KERNLIB, IBM only
Submitter: Submitted: 18.11.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)

CVTVAX converts floating point numbers between host machine and VAX formats. Both Short (32-bit) and Long (64-bit) VAX formats are catered for.

Structure:

SUBROUTINE package
User Entry Names:
SVXDX, SVXSX, SXDVX, SXSVX,
DVXDX, DVXSX, DXDVX, DXSVX

Usage:

    CALL SVXDX(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input VAX 32-bit F 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.
NWORDS
( INTEGER) Constant or variable containing on input the number of VAX numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL DXSVX(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 VAX 32-bit F floating point numbers, in the elements of DWORDS right-adjusted with zero-fill.
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 DVXSX(DWORDS,NWORDS)
DWORDS
( SINGLE PRECISION) Array dimensioned to at least 2*NWORDS in the calling program and containing on input VAX 64-bit D floating point numbers, stored in 2 consecutive pairs of elements of DWORD. After the call the first NWORDS elements will contain converted normalised SINGLE PRECISION floating point numbers in the host machine format.
NWORDS
( INTEGER) Constant or variable containing on input the number of VAX numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.

    CALL SXDVX(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 VAX 64-bit D floating point numbers, 2 consecutive pairs of elements of DWORDS.
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 DVXDX(DWORDS,NWORDS)
DWORDS
( DOUBLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input VAX 64-bits D foating point numbers, stored in the elements of DWORDS. After the call the first NWORDS elements will contain converted normalised DOUBLE PRECISION floating point numbers in the host machine format.
NWORDS
( INTEGER) Constant or variable containing on input the number of VAX numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL DXDVX(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 VAX 64-bits D floating point numbers, one in each element of DWORDS.
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 SVXSX(DWORDS,NWORDS)
DWORDS
( SINGLE PRECISION) Array dimensioned to at least NWORDS in the calling program and containing on input VAX 32-bit F floating point numbers, stored in the consecutive elements of DWORDS. After the call the first NWORDS elements will contain converted normalised SINGLE PRECISION floating point numbers in the host machine format.
NWORDS
( INTEGER) Constant or variable containing on input the number of VAX numbers to be converted. Unchanged on output. A value < 1 causes a do-nothing return.
    CALL SXSVX(DWORDS,NWORDS)
DWORDS
( 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 VAX 32-bit F floating point numbers in the consecutive elements of DWORDS.
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 rounding off 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 VAX short, 55 bits for VAX long, 24 bits for IBM short, 56 bits for IBM long. The precisions obtained in some tests are:
RoutineRounding
SVXSXΔ=0.62 x10-7±0.14 x10-6

0≤Δ≤0.92 x10-6

SVXDXΔ=0.11 x10-19±0.44 x10-18

0≤Δ≤0.17 x10-16

DVXSX0.97 x10-8±0.30 x10-7

0≤Δ≤0.51 x10-6

DVXDXΔ=0.14 x10-16±0.33 x10-16

0≤Δ≤0.22 x10-16

SXSVX(exact conversion)
SXDVXΔ=0.83 x10-9±0.90 x10-9

0≤Δ≤0.48X10-8

DXSVX(exact conversion)
DXDVX(exact conversion)

Exponent ranges also differ between 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. 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-39 to 1038 for VAX short and long floating point numbers. Hence all IBM numbers greater than 1038 will be set to 1038

when converted to VAX DOUBLE and SINGLE PRECISION while any IBM numbers smaller than 10-39 would be set to 10-39 when converted . to VAX format.

Notes:

In the calling sequences above S stands for short representation, i.e. 32 bits on both IBM and VAX, while D stands for long representation, i.e. 64 bits on both IBM and VAX. The default lengths on IBM and VAX are short. The long forms must be explicitly requested by a DOUBLE PRECISION statement. X stands for the host machine and the position of VX and X implies the direction of processing. Hence DVXSX implies convert long VAX format (64-bits) to short host machine format.

M215



next up previous index
Next: M215 Find Power-of-Ten Up: CERNLIB Previous: M109 Sort Rows


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