APP - Base Converter

By:  kossboss

This program not only converts from binary to decimal but from decimal to any base.  Future plans exist so that you can convert from any base to any base.

A note on how I represent digits in any base: Since beyond decimal we only have a concise way for typing hexadecimal and for that we use letters. The value of the hexadecimal digit is on the left and the traditional hexadecimal is in the middle and the method I use is on the right.

                                                HEX VALUE            TRADITIONAL        MY WAY
0  ============ 0 ============ 0
1  ============ 1 ============ 1
2  ============ 2 ============ 2
3  ============ 3 ============ 3
4  ============ 4 ============ 4
5  ============ 5 ============ 5
6  ============ 6 ============ 6
7  ============ 7 ============ 7
8  ============ 8 ============ 8
9  ============ 9 ============ 9 
10 ============ A ============ 10
11 ============ B ============ 11
12 ============ C ============ 12
13 ============ D ============ 13
14 ============ E ============ 14
15 ============ F ============ 15

I had to have a way represent a digit in any base, so beyond 36 letters becoming useless. So I just used the value of the digit it self. You know a new digit begins because there is a space in-between so for example when converting the number 166 to hexadecimal you would expect A6 well in my method you would get 10   6 instead. That way if you converted the number 166 to base 78 or any other outrageous base then you would get a legitimate result.  By the way just for your curiosity 166 in base 78 is 2   10.

Also another important note, when converting from any base to any base. If the original base is ten you can enter the number as you normally would. However with any other original starting base you must include a space between the digits. So if I wrote 54 in base ten it would just be 54 but 54 in base 11 would be 5 4. If I was writing 102 in base 3 I would type 1 0 2.

Also again I don't use letters for hexadecimal digits, so in base 16 which is hex I wouldn't write A6, I would write 10 6.

Also make sure that each digit is acceptable and not equal to or bigger than the actual starting base. For example if starting with base 2, or binary in other words, i can only use digits 0 and 1, there is no such thing as 2 or 3 in binary, so if I wrote 1 0 3 it would error out. Just as with base ten the only acceptable digits are 0 thru 9. Same rules apply to the other bases.

Source Code is available just email me at source@kossboss.com
Also you can get the .NET Framework here: http://www.kossboss.com/vol-size-calculator
ċ
BaseConv-version-1.zip
(12k)
koss boss,
Sep 16, 2012, 8:35 PM
Comments