REAL NUMBERS

Any real number can be normalized to get
±0.XXXX.B±EXP
or
±X.XXX.B±EXP
Now XXXX and EXP are just two integers.  Unfortunately, which B is used, which normalization is used, how many bits used to store XXXX (mantissa)  and EXP (exponent) varies from machine to machine.  The IEEE has set a standard to solidify this mess.  Typical sizes used to store real numbers 32 bits (single precision), 64 bits (double precision) and 128 bits (quadruple precision).
 
 

IBM mainframe

Normalize to 0.XXXX in base 16.  Store:
1 bit for sign. (0 is + and 1 is -).
7 bits in exponent (in excess-64).
24 bits (6 hex digits) mantissa.

Examples

  • -65.2(base 10)  is stored as C2413333
  • +0.04296875(base 10) is stored as 3FB00000
  • C31A0F00 represents -416.9375(base 10)

  •  

    IEEE Format

    Used in 68000 and SPARC.  Normalize to ±1.XXX.2±exp  Store:
    1 bit for sign (0 is +)
    8/11/15 bit for exponent (Excess-2N-1-1)
    23/52/112 bits for mantissa
    leading 1 is not stored anywhere.

    Examples

  • -65.2 in single precision  is stored as C2826666.
  • +0.04296875 in s.p. is stored as 3D300000
  • C2328000 represents -44.625
  • How are the integer 7 and the real 7.0 stored in 4 bytes.
  • How are the integer -7 and the real -7.0 stored in 4 bytes.
  • Special Cases in IEEE floating point

    When exponent = 0000000 it means -2N-1 -2 (not -2N-1-1   as it normally would ) and a leading 0 not 1 is assumed for the exponent 0000000.  They do this to allow for some even tinier numbers.
    0  0000010  000..00 is 1.0*2-125
    0  0000001  000...00 is 1.0* 2-126.
    0  0000000  000...00 is 0
    0  0000000  100...00 is 0.1*2-126= 1*2-127.
    0  0000000  010...00 is 0.01*2-126= 1*2-128.
    0  0000000  000...01 is 0.0..01*2-126= 1*2-149.
    When exponent is 1111...1
    +¥  is                              0  11111111  000...0
    is                               1  11111111  000...0
    Not a number = NaN is  X 11111111  XXX...X   One of right-most X's not 0.
     
     

    Comparison (32 bits)

                              Mainframe                               IEEE

    range                  bigger                                      smaller

    precision             less                                         more
     

    Note 0 is always hard to normalize as there is no non-0 digit to lead with.  So it is always a special case.
     

    CHARACTERS

    Simply choose a unique N-bit code for each desired character. It is desirable to have 0-9 in sequence, A-Z in sequence and a-z in sequence. Also an easy relationship between A-Z and a-z would be nice. These are collating sequences.

    Three Standards

    Other Data Types

    There is no indication what a sequence of 0/1's stands for. Eg. A 32 bit word in 68000 contains:
    442B3130. What is stored there?
    1. If 4 ASCII characters, it is D+10.
    2. If unsigned integer, it is 1,143,681,328.
    3. if signed number, it is 1,143,681,328.
    4. if real number, it is approximately 342.384277
    5. if an instruction, it is CHK.l($3130),D2 (almost)