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

M220 Conversion To and From IEEE Number Format

Routine ID: M220
Author(s): J. Zoll, M. Jonker, M. RoethlisbergerLibrary: KERNLIB
Submitter: Submitted: 30.11.1986
Language: Fortran or AssemblerRevised: 01.04.1994

These routines convert vectors of single- or double- precision numbers between the internal and the standard IEEE representations.

Structure:

SUBROUTINE subprograms
User Entry Names: IE3FOS, IE3FOD, IE3TOS, IE3TOD

Usage:

IEEE for/to internal, single precision:

    CALL IE3FOS(VSINGL,VIEEES,NV,JCODE)
    CALL IE3TOS(VIEEES,VSINGL,NV,JCODE)
VSINGL
Vector of NV words with floating point numbers in internal representation.
VIEEES
Vector of NV words with the same floating point number in IEEE representation.
NV
Size of the vectors.
JCODE
Error code returned, normally zero,otherwise VSINGL(JCODE) is the last number which had conversion problems, such as overflow and not-a-number.
IEEE for/to internal, double precision:
    CALL IE3FOD(VDOUBL,VIEEED,NV,JCODE)
    CALL IE3TOD(VIEEED,VDOUBL,NV,JCODE)
VDOUBL
Vector of 2*NV words with NV double-precision floating point numbers in internal representation.
VIEED
Vector of 2*NV words with the same floating point numbers in IEEE representation.
NV
Size of the vectors.
JCODE
Error code returned, normally zero, otherwise VDOUBL(JCODE) is the last number which had conversion problems, assuming the declaration DOUBLE PRECISION VDOUBL(NV).

Notes:

The IEEE format provides for representing exceptions, both for single and for double precision:
a) Not-a-number: single 7F8nnnnn,
double 7FFnnnnn....
b) Positive infinity: single 7F800000,
double 7FF00000....
c) Negative infinity: single FF800000,
double FFF00000....

Depending on the machine, mapping is done either naturally or artificially:
CDC 2lIndefinite maps to not-a-number,overflow to infinity.
CRAY 2lOverflow maps to infinity,not-a-number gives overflow.
IBM Positive infinity maps to internal 7FFFFFF0,
not-a-number maps to internal 7FFFFFFF.
NORD Positive infinity maps to internal 177...70,
not-a-number maps to internal 177...77.
VAX Positive infinity maps to internal 00007F81,
not-a-number maps to internal 00008001.

Underflow gives exact zero in all cases.

On the VAX: if a file has been imported from a big-endian machine, byte-inversion (see VXINV (M434)) has to be done before calling IE3TOx; similarly byte-inversion has to be done after calling IE3FOx and before exporting the file.

On machines where the internal representation is IEEE (Apollo, Sun, Silicon Graphics, etc) these routines are simple copy operations.

M231



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


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