Next: M215 Find Power-of-Ten
Up: CERNLIB
Previous: M109 Sort Rows
Routine ID: M214
| Author(s): F. Carminati | Library: KERNLIB, IBM only
|
Submitter: | Submitted: 18.11.1986
|
Language: Fortran | Revised:
|
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
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
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
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
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
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
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
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
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:
Routine | Rounding
|
SVXSX |
|
|
|
SVXDX |
|
|
|
DVXSX |
|
|
|
DVXDX |
|
|
|
SXSVX | (exact conversion)
|
SXDVX |
|
|
|
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
to
for IBM short and long and
to
for VAX short and long floating point numbers.
Hence all IBM numbers greater than
will be set to
when converted to VAX DOUBLE and SINGLE PRECISION while any
IBM numbers smaller than
would be set to
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: M215 Find Power-of-Ten
Up: CERNLIB
Previous: M109 Sort Rows
Janne Saarela
Mon Apr 3 15:06:23 METDST 1995