HEX - hex floating point conversion routines.


<type> in, out
call XXtoYY(in, out)


<type> in, out, XXtoYY
out = XXtoYY(in)


if one of the floating point types "real", "double precision", "complex" or "double complex".
is an expression of type "<type>" in the floating representation being converted from.
is a variable of type "<type>" and will receive a value in the converted represention.
is the name of the conversion routine. One of "XX" or "YY" must be the letters "hx". Routines of the form "XXtohx" convert from binary floating point to hex floating point; routines of the form "hxtoYY" convert to binary floating point from hex floating point. The other of "XX" or "YY" is chosen to agree with "<type>".
for real (single precision).
for double precision.
for complex.
for double complex.


hexone = stohx(1.0)


Fortran 77 supports two floating point representations, binary (base 2) and hex (base 16). Both representations use the same number of bits to represent the exponent and mantissa. Hex floating point has a larger dynamic range, but is less accurate and has some nasty (and surprising) numerical properties.

A given program will do all its calculations in only 1 format. However, it may have to read or write a data file for a program that uses the other format. To help with this, the library supplies eight routines to convert between formats. These routines just convert between formats; they do not do any calculations so they work with programs that use either floating point format.

These routines can be called as a two argument subroutine, or as a single argument functions of the appropriate type.


Some sites disable hex mode entirely with during system startup.

Copyright © 1996, Thinkage Ltd.