BitViewer Help Contents
Contents for BitViewer Help

BitViewer is a utility which allows you to view and manipulate the values of basic computer data types: characters, integers, and real numbers (also called floating-point reals).  For each data type BitViewer displays three equivalent representations:

    1.	The natural value (such as "Q" for a character or "4.25" for a real number)

    2.	The hexadecimal representation of the value

    3.	The binary representation of the value

You can directly alter any of the displayed values.  Whenever you change one of the three representations, the other two are updated to match.  Similarly, you can convert data from one data type to another.

BitViewer also contains a number of options to help you manipulate the data types, and to explore and visualize the rules by which the computer stores data values.

BitViewer Controls

Accelerators and Keyboard Access

Options Menu Commands

Data Type Menu Commands

Character Information

Integer Information

Floating-Point Real Information


BitViewer Controls

The BitViewer controls are all shown in the application's window.  There are 5 main controls:

    The Value Box, labeled with the text "Value"

    The Hex Box, labeled with the text "Hex"

    The Byte Select buttons, grouped within the frame labeled "Bytes"

    The Bit Buttons; five push buttons in a row below the hex box

    The Bit Boxes; the bar at the bottom containing one box per bit

The controls are described below.  Each control can be accessed with the keyboard as well as with the mouse by using its Accelerator Key.

Value Box	The value box displays the value in its natural (human-readable) form.  You may enter any value in the value box that is appropriate to the current data type.  Examples

Hex Box	The hex box displays the value in hexadecimal format.  Hexadecimal is a shorthand form of binary in which each hexadecimal digit equals four binary digits.

Note:  For both the value box and the hex box, you can change values by inserting and deleting text from existing values.  You can also cut and paste whole values or parts of values.

Byte Select	Within the frame labeled "Bytes" are buttons which control the length of the data type and the number of bit boxes displayed.  Each byte equals eight bits.  Not all lengths are available for all data types.  Integer data types are not valid in eight-byte length, and floating-point real data types are not valid in one or two-byte lengths.

Bit Buttons	Below the hex box are five push buttons.  Each of these buttons affects all of the bits of the currently displayed data type.  The five buttons and their functions are:

    <	Shift bits one position left

    >	Shift bits one position right

    0's	Set bits to 0

    1's	Set bits to 1

    Flip	Reverse the value of bits (turn 0's to 1's, and 1's to 0's)

For the shift buttons, the values of the bit being shifted off the end of the value, and of the bit being shifted into the value are determined by the shift control option selected in the Options menu.

Note:  Any bits that are not currently visible in the bit boxes are unaffected by the bit buttons.

Bit Boxes	The bottom portion of the BitViewer window contains a box for each bit of the binary representation of the value.  Each bit box holds either a 0 or a 1.  You can toggle the value of any bit between 0 and 1 by clicking on that bit with the left mouse button.  You can hold down the left mouse button and drag the cursor over the bit boxes to toggle any number of bits.

The right mouse button also has an effect when used on bit boxes.  It never alters data, but it provides additional information.  A single-click of the right mouse button identifies the hexadecimal digit to which a bit belongs by highlighting that digit in the hex box and placing a marker over the corresponding group of four bits.

You can hold down the right mouse button and drag the cursor over the bit boxes in order to identify the hexadecimal digits for any number of bits.  A double-click of the right mouse button produces a Bit Information box for that bit.


Accelerators and Keyboard Access

Every BitViewer function is accessible with the keyboard as well as with the mouse.  The Tab and Shift+Tab keys move between the controls in order.  Also, each control has an accelerator key combination.  Each control's accelerator is the Alt key + the underlined character in the control's label (if there is one).

For the byte select buttons, you can use Alt+B to go to the button frame, and then use the arrow keys to move among the available byte select buttons.

For the bit boxes, you can use Alt+Enter to go to the bit boxes, and then use the arrow keys and the Home and End keys to move among them.  A bit marker tracks your position and identifies the current bit.

While on a bit, you can press the Space Bar to toggle the bit (simulating a left mouse button click).  The Escape key identifies the hexadecimal digit to which a bit belongs by highlighting that digit in the hex box and placing a marker over the corresponding group of four bits (simulating a right mouse button click).  The Enter key produces a Bit Information box for that bit (simulating a right mouse button double-click).

For the shift left (<) and shift right (>) bit buttons, it is not necessary to hold down the Shift key to access the accelerators.


Options Menu Commands

The first two items in the Options menu allow you to control the appearance of the bit boxes.  When the Color Bits item is checked, the 0's and 1's in the bit boxes are displayed in red and green respectively.  When the Color Bits item is unchecked, all bit boxes are displayed in black.

When the Shade FP Exponent item is checked, all bits in the exponent field of a floating-point real number are displayed in black on gray (regardless of the state of the Color Bits option).

The next three items, Shift in 0's, Shift in 1's, and Logical Shift are the shift control options.  Only one of these options can be in effect (checked) at any one time.  The shift control option that is in effect determines the behavior when either of the shift bit buttons is pressed.  Examples

When the Error Boxes option is checked, attempts to enter invalid values into either the value box or the hex box cause a message box to pop up informing you of the invalid action.  When this option is not checked, invalid values are still not accepted, but BitViewer just beeps to alert you to the error.

The Report option brings up a Datatype Information dialog box with summary information about the data presently being viewed.


Data Type Menu Commands

The items in the Data Type menu change the way in which data is displayed in the value box.  None of these options alters the data; they only change how it is interpreted for input and output in the value box.  The hex box and bit boxes remain the same when changing from one data type to another.

Note:  Changing to a new data type can affect the number of bytes that can be viewed.  For example, if you are viewing an 8-byte character value and change to an integer data type, BitViewer will reduce the number of bytes to 4, since 8 is invalid for integers.

The name of the currently selected data type is displayed in BitViewer's Title Bar.


Character data type information

Character Information

Character variables occupy 1 byte of memory for each character and are assigned to continuous bytes, independent of word boundaries.

Note:  BitViewer displays null characters (hex 00) as spaces (hex 20) in order to preserve the positioning of following characters.

ASCII Character Codes

The ASCII character code tables contain the decimal and hexadecimal values of the extended ASCII (American Standards Committee for Information Interchange) character set. The extended character set includes the ASCII character set and 128 other characters for graphics and line drawing, often called the "IBM® character set."

ANSI Character Codes

The ANSI character code chart lists the extended character set of most of the programs used by Windows. The codes of the ANSI (American National Standards Institute) character set from 32 through 126 are displayable characters from the ASCII character set. The ANSI characters displayed as solid blocks are undefined characters and may appear differently on output devices.


Integer data type information

Integer Information

An integer value is a binary representation of the corresponding integer. The following table shows the different types of integers and the range of each type.

Bytes	Signed Range 	Unsigned Range

    1	-128 to 127	0 to 255

    2	-32,768 to 32,767	0 to 65535

    4 	-2,147,483,648 to	0 to 4294967295

 2,147,483,647

Representing Numbers

The effect of math computations on integers is straightforward. Integers consist of a maximum positive integer, a minimum negative integer, and all integers between them including zero. Operations on integers result in other integers within this range. The only arithmetic rule to remember is that integer division results in truncation (for example, 8/3 evaluates to 2).


Floating-point real data type information

Floating-Point Real Information

Floating-Point Formats

IEEE Std 754 specifies values and requirements for floating-point representation (such as base 2). The standard outlines requirements for two formats: basic and extended, and for two word-lengths within each format: single and double.

BitViewer follows the rules of the basic format, for both single (4-byte) and double (8-byte) numbers.

Floating-Point Representation

Floating-point numbers approximate real numbers with a finite number of bits, as shown in the following formula. The representation is binary, so the base is 2. The bits bi represent binary digits (0 or 1). The precision P is the number of bits in the non-exponential part of the number (the significand), and E is the exponent. With these parameters, binary floating-point numbers approximate real numbers with the values:

(-1)**s b0 b1 b2 ··· bP-1 x 2**E

where s is 0 or 1 (+ or -), and Emin <= E <= Emax. The following table gives the standard values for these parameters for single and double formats and the resulting bit widths for the sign, the exponent, and the full number.

Parameter	Single	Double

Sign width in bits	1	1

P	24	53

Emax	+127	+1023

Emin	 126	1022

Exponent bias	+127	+1023

Exponent width in bits	8	11

Format width in bits	32	64

The standard requires that the single and double formats be normalized, so b0 is always 1. The actual number of bits needed to represent the precisions 24 and 53 is therefore 23 and 52, respectively, since b0 is chosen to be 1 implicitly.

A bias is added to all exponents so that only positive integer exponents occur. This expedites comparisons of exponent values. The stored exponent is actually:

e = E + bias.

Special Values

Special cases of the exponent-significand combination represent four types of special values in addition to the normalized numbers. The following table shows all five types of values.

Name	Quantity	Exponent	Significand

Signed zero	± 0	E = Emin - 1	sig = 0

Denormalized number	± 0 . sig x 2**Emin	E = Emin - 1	sig <> 0

Normalized number	± 1 . sig x 2**E	 	Emin <= E <= Emax	sig

Signed infinity	± infinity	E = Emax + 1	sig = 0

Not a Number	NaN	E = Emax + 1	sig <> 0

These special values are interpreted as follows:

Signed zero

The sign of zero is the same as the sign of a non-zero number. A signed zero is useful in certain numerical analysis algorithms, but in most applications the sign of zero is invisible.

Denormalized numbers

Denormalized numbers (denormals) fill the gap between the smallest positive number and the smallest negative number. Otherwise only (±) 0 occurs in that interval. Denormalized numbers permit gradual underflow for intermediate results calculated internally in extended double format.

Signed infinity

Infinities are the result of arithmetic in the limiting case of operands with arbitrarily large magnitude. They provide a way to continue when an overflow occurs. The sign of an infinity is simply the sign you obtain for a finite number in the same operation as the finite number approaches an infinite value.

Not a Number

Not a Number (NaN) results from an operation involving one or more invalid operands. For instance 0/0 and the square root of -1 result with NaN. In general, an operation involving a NaN produces another NaN. Because the fraction of a NaN is unspecified, there are many possible NaNs.

The Form of a Floating-Point Real Number

A real constant is composed of an optional plus or minus sign, an integer, decimal point, fraction, and exponential notation.

A real constant has the following form:

[ sign ] [ integer ].[ fraction ] [ Eexponent | Dexponent ]

sign

A sign (+ or -).

integer

The integer part, consisting of one or more decimal digits. Either integer or fraction may be omitted, but not both.

fraction

The fraction part, consisting of one or more decimal digits. Either fraction or integer may be omitted, but not both.

Eexponent

An exponent part, consisting of an optionally signed one- or two-digit integer constant for single precision, or up to three signed integer digits for double precision. An exponent indicates that the value preceding the exponent is to be multiplied by 10 raised to the value exponent.

Dexponent

An exponent part, consisting of an optionally signed one-, two-, or three-digit integer constant for double precision type.

A double-precision real constant has the same form as a single-precision real constant, except that the letter D is used for exponents instead of the letter E. The exponent part is mandatory if a letter is present.

The following table shows the different types of real values, the decimal precision, and the range of each type.

Bytes	Precision	Range

    4	6 digits	negative numbers from approximately

   3.4028235E+38 to 1.1754944E38

zero

positive numbers from approximately

   +1.1754944E38 to +3.4028235E+38

    8	15 digits	negative numbers from approximately

   1.797693134862316D+308 to 2.225073858507201D308

zero

positive numbers from approximately

   +2.225073858507201D308 to +1.797693134862316D+308

Representing Numbers

The effect of math computations on integers is straightforward. Integers consist of a maximum positive integer, a minimum negative integer, and all integers between them including zero. Operations on integers result in other integers within this range. The only arithmetic rule to remember is that integer division results in truncation (for example, 8/3 evaluates to 2).

Computations on real numbers, however, may not yield what you expect. This happens because the hardware must represent numbers in a finite number of bits. There are several effects of using finite floating-point numbers. The hardware is not able to represent every real number exactly, but must approximate exact representations by rounding or truncating to finite length. In addition, some numbers lie outside the range of representation of the maximum and minimum exponents and can result in calculations that underflow and overflow. As an example of one consequence, finite precision produces many numbers that, although non-zero, behave in addition as zero.


Value Box Examples

Here are examples of valid and invalid values for the integer and floating-point real data types.  (For character data types, all input is valid.)

Unsigned Integer.  Only the digits 0-9 may be entered.

      Valid      Invalid

         15         15.0  (decimal points not permitted)

       0003           +3  (signs not permitted)

      12345       12,345  (commas not permitted)

Signed Integer.  The digits 0-9 may be entered, optionally preceded by a plus or minus sign.

      Valid      Invalid

        +34         ++34  (only one sign per number)

       -054        -  54  (spaces not permitted within any numeric value)

          8           8+  (sign must precede number)

Floating-Point Real.  The digits 0-9 may be entered, optionally preceded by a plus or minus sign.  The number may contain a decimal point.  An exponent may be entered at the end of the number.  Exponents begin with the letter E (in upper or lower case), followed by an optional plus or minus sign, followed by the digits 0-9.

      Valid      Invalid

        1.2        1.2.0  (only one decimal point per number)

     +05.50       5.5d+1  (the letter e must be used to mark exponents)

    7.1E+11       7.1+11  (the letter e must be used to mark exponents)

    7.1e-03      7.1e03-  (signs must occur at the start of a number or exponent)


Hexadecimal Digit

The hexadecimal numbering system consists of the decimal digits 0 through 9, plus the letters A through F, which stand for 10 through 15 respectively.  With these 16 "hex" digits, all possible patterns of four bits are represented:

  Binary  Decimal  Hex    Binary  Decimal  Hex

   0000      0      0      1000      8      8

   0001      1      1      1001      9      9

   0010      2      2      1010     10      A

   0011      3      3      1011     11      B

   0100      4      4      1100     12      C

   0101      5      5      1101     13      D

   0110      6      6      1110     14      E

   0111      7      7      1111     15      F


Shift Examples

For left shifts (<), bits move to the next higher-numbered position.  For right shifts (>), bits move to the next lower-numbered position.  In each of these cases, one bit gets shifted off the end of the value, and one new bit gets shifted into the value.  The values of these end bits are determined by the Shift Control option.

Shifting Left	Shifting Right

Shift	High bit lost; low bit = 0	Low bit lost; high bit = 0

  in 0's	 Before       After	 Before       After

10111101    01111010	10111101    01011110

01111010    11110100	01011110    00101111

Shift	High bit lost; low bit = 1	Low bit lost; high bit = 1

  in 1's	 Before       After	 Before       After

10111101    01111011	10111101    11011110

01111011    11110111	11011110    11101111

Logical	High bit moves to low bit	Low bit moves to high bit

  Shift	 Before       After	 Before       After

10111101    01111011	10111101    11011110

01111011    11110110	11011110    01101111


Bit Information

The Bit Information box is a dialog box with summary information about the specific bit chosen, such as the following.

All Bit Information boxes identify the bit's number and the meaning of that bit within the context of the currently selected data type.

While the Bit Information box is shown, you can select any or all of the text in the box to copy to the clipboard.  Press Tab to select all of the text.  Use the mouse or Shift+directional keys to select a specific portion of the text.  Use Ctrl+Insert or Ctrl+C to copy selected text.


Datatype Information

The Datatype Information box is a dialog box with summary information about the data presently being viewed, such as the following.

While the Datatype Information box is shown, you can select any or all of the text in the box to copy to the clipboard.  Press Tab to select all of the text.  Use the mouse or Shift+directional keys to select a specific portion of the text.  Use Ctrl+Insert or Ctrl+C to copy selected text.


Bit Marker

The Bit Marker is a small horizontal line that appears just above or below the bit box which was most recently clicked on with the mouse or moved to with an arrow key.

For bytes 1-4, the bit marker appears below the bit boxes.  For bytes 5-8, the bit marker appears above the bit boxes.

When all eight bytes are being displayed you can use the up and down arrow keys to move to the bit box directly above or below the current bit.  When four or fewer bytes are being displayed, the up and down arrow keys behave the same as the right and left arrow keys respectively.