Writing Real Programs in DCL, Second Edition

Appendix A: Hexadecimal Notation

MODERN DIGITAL COMPUTERS operate in the binary number system, so they represent data internally as quantities in base 2. Each binary digit is called a bit. DCL supports integer quantities, which occupy 32 bits. In both the VAX and the Alpha architectures, a collection of 32 bits is called a longword, so DCL supports longword integers.

Programming languages such as DCL allow integers to be represented externally as decimal numbers, performing the necessary conversion to binary when the programs are prepared for execution. Decimal integers are appropriate for most situations, but occasionally the actual bit patterns within the integer are important. An example of this is the Open VMS status code, a longword integer that is divided into several bit fields. When the bit patterns are important, the decimal number system is not a particularly useful external representation.

Picture the longword integer 96,877 in binary:

A programming language might allow integers to be specified in binary, but doing so would require the programmer to type a sequence of 32 ones and zeros. The chance of making an error in the number is high. In order to reduce the length of the digit sequence, the base 16, or hexadecimal, number system is employed. Since the hexadecimal base, 16, is a power of the binary base, 2, the conversion from binary to hexadecimal is nothing more than a grouping operation. Begin by separating the binary digits into groups of 4:

Each group contains 4 binary digits and has 1 of...

UNLIMITED FREE ACCESS TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Pushwheel Switches
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.