1.3 Internal Representation of Floating-Type Values

A common expression is used for internal representation of integers by most computers. In contrast, there are several specifications for the representation of  floating-point numbers. REALLIB is a utility for transferring data between computers that do not share the same specification for floating-point numbers.

Generally, real-number-type variables are represented as floating-point numbers. Thus, in ¦Â-base representation, a real number is expressed as:

¡Þ(0.f1f2f3¡¦¡¦¡¦fm)¦Â¡ß¦Â¡ÞE (1)

Here,

¡Þ(0.f1f2f3¡¦¡¦¡¦fm) = ¡Þ(f1¡ß¦Â-1 + f2¡ß¦Â-2 +f3¡ß¦Â-3 +¡¦¡¦¡¦fm¡ß¦Â-m) (2)

corresponds to the fixed-point part, and fi  are integers with values of 0 to ¦Â-1, where f1 ¡â0.  E is the exponent part and is either 0 or a positive integer. 

The floating- point representation used in most mainframe systems is the IBM standard. However, most compilers such as for UNIX adopt the IEEE (read as "I triple E") standard. Although both standards use 32-bit words, they do not share a common numbering system. Thus, there are differences in the range and precision of real number that can be represented by the two standards.

It can be seen that even when the same number of bits are used to represent a number, the range and precision of the floating-point number that can be represented are different for different systems. In the Dennou library, these system-dependent constants are handled by MATH1/SYSLIB ¤Î GLpSET/GLpGET.

Below is a list of representation methods used by computers around us. 

Computer OS Compiler Floating-point representation method Notes
FACOM MSP(General purpose) FORT77EX IBM  
FACOM XMP(UNIX) FORT77EX IBM  
HITAC VOS3(General purpose) ?? IBM  
HITAC HIUXM(UNIX) f77 IBM  
SUN UNIX SUN FORTRAN IEEE  
PC9801 MS-DOS F77L(Lahey) IEEE  
PC9801 MS-DOS BASIC Others*  

Note (*): this is a binary representation that resembles IEEE, but it has a different elevation value for the exponent part and a different position for the sign bit.