CodePlexProject Hosting for Open Source Software

**Version 1.5**

**Copyright(c) 2011, Simnix**

This program is designed to convert decimal to binary and hexadecimal and visa versa, plus display the 2's compliment equivalent of the number inputed.

When the program starts the defualt binary limit is 8 bit. You can select 8 bit, 16 bit and 32 bit binary limits from the menu.

**Base # Conversion**

**Decimal**

Type in a positive number upto the binary limit and the binary, hexadecimal and 2's compliment equivalent will be displayed. A warning message will be displayed if you try to type in a number above the binary limit. You can only type 0 to 9 in the decimal textbox.

**Hexadecimal**

Type in a hexadecimal number upto the binary limit and the binary, decimal and 2's compliment equivalent will be displayed. You can only type in 1's and 0's in the binary textbox.

**Binary**

Type in a binary number upto the binary limit and the decimal, hexadecimal and 2's compliment will be displayed. You can only type 0 to 9 and A to F in the hexadecimal textbox.

**Binary Arithmetic**

Arithmetic is at the heart of the digital computer, and the majority of arithmetic performed by computers is binary arithmetic, that is, arithmetic on base two numbers. Decimal and floating-point numbers, also used in computer arithmetic, depend on binary representations, and an understanding of binary arithmetic is necessary in order to understand either one.

Computers perform arithmetic on fixed-size numbers. The arithmetic of fixed-size numbers is called finite-precision arithmetic. The rules for finite-precision arithmetic are different from the rules of ordinary arithmetic.

The sizes of numbers which can be arithmetic operands are determined when the architecture of the computer is designed. Common sizes for integer arithmetic are eight, 16, 32, and recently 64 bits. It is possible for the programmer to perform arithmetic on larger numbers or on sizes which are not directly implemented in the architecture. However, this is usually so painful that the programmer picks the most appropriate size implemented by the architecture. This puts a burden on the computer architect to select appropriate sizes for integers, and on the programmer to be aware of the limitations of the size he has chosen and on finite-precision arithmetic in general.

We are considering binary arithmetic in the context of building digital logic circuits to perform arithmetic. Not only do we have to deal with the fact of finite-precision arithmetic, we must consider the complexity of the digital logic. When there is more than one way of performing an operation we choose the method which results in the simplest circuit. Finite-Precision.

**Finite-Precision Arithmetic**

Consider what it would be like to perform arithmetic if one were limited to three-digit decimal numbers. Neither negative numbers nor fractions could be expressed directly, and the largest possible number that could be expressed is 999. This is the circumstance in which we find ourselves when we perform computer arithmetic because the number of bits is fixed by the computer’s architecture. Although we can usually express numbers larger than 999, the limits are real and small enough to be of practical concern. Working with unsigned 16-bit binary integers, the largest number we can express is 216-1, or 65,535. If we assume a signed number, the largest number is 32,767.

There are other limitations. Consider again the example of three-digit numbers. We can add 200 + 300, but not 600 + 700 because the latter sum is too large to fit in three digits. Such a condition is called overflow and it is of concern to architects of computer systems. Because not all operations which will cause overflow can be predicted when a computer program is written, the computer system itself must check whether overflow has occurred and, if so, provide some indication of that fact.

Tannenbaum points out that the algebra of finite-precision is different from ordinary algebra, too. Neither the associative law nor the distributive law applies. Two examples from Tannenbaum illustrate this. If we evaluate the expression

a + (b - c) = (a + b) - c

using a = 700, b= 400, and c=300, the left-hand side evaluates to 800, but overflow occurs when evaluating a + b in the right-hand side. The associative law does not hold.

Similarly if we evaluate

a x (b - c) = a x b - a x c

using a = 5, b = 210, and c = 195, the left-hand side produces 75, but in the right-hand side, a x b overflows and distributive law does not hold. These two examples show the importance of understanding the limitations on computer arithmetic. This understanding is important to programmers as well as designers of computers.

**Roman Numerals**

The Romans were active in trade and commerce, and from the time of learning to write they needed a way to indicate numbers. The system they developed lasted many centuries, and still sees some specialized use today.

Roman numerals traditionally indicate the order of rulers or ships who share the same name (i.e. Queen Elizabeth II). They are also sometimes still used in the publishing industry for copyright dates, and on cornerstones and gravestones when the owner of a building or the family of the deceased wishes to create an impression of classical dignity. The Roman numbering system also lives on in our languages, which still use Latin word roots to express numerical ideas. A few examples: unilateral, duo, quadriceps, septuagenarian, decade, millilitre.

The big differences between Roman and Arabic numerals (the ones we use today) are that Romans didn't have a symbol for zero, and that numeral placement within a number can sometimes indicate subtraction rather than addition.

I |
The easiest way to note down a number is to make that many marks - little I's. Thus I means 1, II means 2, III means 3. However, four strokes seemed like too many.... |

V |
So the Romans moved on to the symbol for 5 - V. Placing I in front of the V — or placing any smaller number in front of any larger number — indicates subtraction. So IV means 4. After V comes a series of additions - VI means 6, VII means 7, VIII means 8. |

X |
X means 10. But wait — what about 9? Same deal. IX means to subtract I from X, leaving 9. Numbers in the teens, twenties and thirties follow the same form as the first set, only with X's indicating the number of tens. So XXXI is 31, and XXIV is 24. |

L |
L means 50. Based on what you've learned, I bet you can figure out what 40 is. If you guessed XL, you're right = 10 subtracted from 50. And thus 60, 70, and 80 are LX, LXX and LXXX. |

C |
C stands for centum, the Latin word for 100. A centurion led 100 men. We still use this in words like "century" and "cent." The subtraction rule means 90 is written as XC. Like the X's and L's, the C's are tacked on to the beginning of numbers to indicate how many hundreds there are: CCCLXIX is 369. |

D |
D stands for 500. As you can probably guess by this time, CD means 400. So CDXLVIII is 448. (See why we switched systems?) |

M |
M is 1,000. You see a lot of Ms because Roman numerals are used a lot to indicate dates. For instance, this page was written in the year of Nova Roma's founding, 1998 CE (Common Era; Christians use AD for Anno Domini, "year of our Lord"). That year is written as MCMXCVIII. But wait! Nova Roma counts years from the founding of Rome, ab urbe condita. By that reckoning Nova Roma was founded in 2751 a.u.c. or MMDCCLI. |

Last edited Jan 11, 2011 at 7:28 PM by simnix, version 14

JlueJay

*version 1.5*

CopyRight (c) 2011

Added binary arithmetic tab to the software.

*version 1.5*

CopyRight (c) 2011

Added binary arithmetic tab to the software.