Representation of Numbers on HP and VAX Computers

## Representation of Numbers on HP and VAX Computers

Goals:This laboratory has the following purposes:
• To develop an expanded understanding of the storage of numeric data on both the HP and VAX computers through experimentation,
• To clarify integer data type,
• To give students experience with real data type, and
• To allow for comparison of the storage of numeric data on both the HP and VAX computers (both of which are 32-bit machines).

Preparation Before the laboratory session, write binary patterns for

• integers ± 1, ± 2, ± 3, ± 6, ± 9 using sign/magnitude notation, ones complement notation, and twos complement notation, and
• real numbers ± 1.0, ± 2.0, ± 3.0, and 4.0, 5.0, ..., 11.0 .
In the Laboratory:

• Run program bitexam from HP directory ~walker/pascal .

1. Enter positive integers and check that the bit patterns correspond to the binary representations you calculated before the lab.

2. Enter negative integers and determine which notation is used on the HP computers. Be sure you can justify your answer by citing output you obtained.

3. Enter real numbers, and conduct experiments to determine:
• which bit is the sign bit,
• which bits are used for the mantissa,
• which bits are used for the exponent, and
• what bias is used in the storage of exponents.

4. Use your knowledge of storage of real numbers to determine what real number comes ``immediately after'' 2.0 and 11.0 on this system.

• Repeat the above steps running bitexam from VAX directory [walker.modula2]

Work to be turned in: Your lab write-up should contain both your computations from the lab preparation and your results from the lab itself. Further, you should document how both negative integers and real numbers are stored in both the HP and VAX computers based on your experiments in the lab. Finally, you should compare how the two machines store numbers. Are the storage algorithms the same? If so, justify your conclusions. If not, explain how the storage is different.

This document is available on the World Wide Web as

```     http://www.math.grin.edu/~walker/courses/211/labs/lab.data-rep.html
```

created August 18, 1997
last revised August 29, 1997