# Decimal-Binary-Hex-Base7 Conversions with Radix Points?

I was hoping someone on here could help explain number base conversions with Radix points. I'm pursuing my Bachelors Degree in Computer Science with 12 courses remaining, currently in a Computer Hardware course.

For one of my assignments, I had to complete the following table (grey areas are the values I was given to convert to each of the others):

Here is more of my work for the other conversions not directly shown in the table:

DecToBin(37) = (37/2=1) (18/2=0) (9/2=1) (4/2=0) (2/2=0) (1/2=1)
=== 101001 or in reverse order 100101
DecToBin(99) = (99/2=1) (49/2=1) (24/2=0) (12/2=0) (6/2=0) (3/2=1) (1/2=1)
=== 1100011 or in reverse order 1100011
DecToBin(256) =  (598/2=0) (299/2=1) (149/2=1) (74/2=0) (37/2=1) (18/2=0) (9/2=1) (4/2=0) (2/2=0) (1/2=1) === 0110101001 or in reverse order 1001010110
DecToBin(3243) = (3243/2=1) (1621/2=1) (810/2=0) (405/2=1) (202/2=0) (101/2=1) (50/2=0) (25/2=1) (12/2=0) (6/2=0) (3/2=1) (1/2=1)  === 1101 0101 0011 or in reverse order 1100 1010 1011
DecToB7(37) = (37/7) = 5r2 or 52;
DecToB7(99) = (99/7)  = 14r1, (14/7) = 2r0; == 201;
DecToB7(170) = (170/7) = 24r2; (24/7) = 3r3; == 332;
DecToB7(1757) = (1757/7) = 251r0; (251/7) = 35r6; (35/7) = 5r0; == 5060;
DecToB7(598) = (598/7) = 95r3; (95/7) = 13r4; (13/7) = 1r6;
DecToB7(3243) = (3243/7) = 463r2; (463/7) = 66r1; (66/7) = 9r3; (9/7) = 1r2; == 12312;
B7toDec(12) = (1*7^1)+(2*7^0) = (7)+(2) = 9 in Decimal
B7toDec(666) = (6*7^2)+(6*7^1)+(6*7^0) = 342 in Decimal
DecToBin(9) = (9/2=1) (4/2=0) (2/2=0) (1/2=1) === 1001 or in reverse order 1001
DecToBin(342) = (342/2=0) (171/2=1) (85/2=1) (42/2=0) (21/2=1) (10/2=0) (5/2=1) (2/2=0) (1/2=1)
=== 011010101 or in reverse order 101010110


Now I've been given a second table to do the same, but this one I am to include calculating all the values to four places after the radix point. My book itself isn't very clear only talking about radix points in a chapter for 2 sentences, and what I've found online hasn't really "clicked" for me.

Can someone take a stab at explaining how I would convert with the radix points as described? I'm not looking for answers, just for someone to provide some examples which will enable me to understand what is being asked and how to go about it.

Any and all assistance appreciated! This class has been tough all around thus far and I'm still playing catch up in a few areas :)

EDIT:

Can anyone confirm if I'm on the right track going over to Decimal?

BinaryToDec(11011.0111) = 2^4+2^3+0+2^1+2^0 . +0+2^-2+2^-3+2^-4 = 30.4375
BinaryToDec(111.0111) = 2^2+2^1+2^0 . +2^-1+0+2^-3+2^-4 = 7.6875
HexToDec(2.08) = (2*16^0)+. (0)+(8*16^-2) = 2.03125
HexToDec(AB.C) = (10*16^1)+(11*16^0)+ . (12*16^-1) = 171.75
Base7ToDec(1.2) = (1*7^0) . + (2*7^-1) = 1.285714286
Base7ToDec(66.6) = (6*7^1)+(6*7^0)+ . (6*7^-1) = 48.85714286


EDIT2:

Making some progress:

DecToBin(0.25) = 2^-2 = 0.25 or 0.0100
DecToBin(0.35)=
BinaryToDec(11011.0111) = (2^4)+(2^3)+(0)+(2^1)+(2^0) + (0)+(2^-2)+(2^-3)+(2^-4) = 27.4375
BinaryToDec(111.1011) = (2^2)+(2^1)+(2^0) + (2^-1)+(0)+(2^-3)+(2^-4) = 7.6875
HexToDec(2.08) = (2*16^0) + (0)+(8*16^-2) = 2.03125 or by specs 2.0313
HexToDec(AB.C) = (10*16^1)+(11*16^0) + (12*16^-1) = 171.75 or by specs 171.7500
Base7ToDec(1.2) = (1*7^0)+(2*7-1) = 1.285714286 or by specs 1.2857
Base7ToDec(66.6) = (6*7^1)+(6*7^0) + (6*7^-1) = 48.85714286 or by specs 48.8571
http://cs.furman.edu/digitaldomain/more/ch6/dec_frac_to_bin.htm
DecToBinary(0.25) = 0.25*2 = 0.50 (0.0???); 0.50*2 = 1.00 (0.01??); 00*2 = 0, so answer is 0.0100
DecToBinary(0.35) = 0.35*2 = 0.70 (0.0???); 0.70*2 = 1.4 (0.01??); 0.4*2 = 0.80 (0.010?);
0.80*2 = 1.60 (0.0101????); 0.6*2 = 1.20 (0.01011???); 0.2*2 = 0.4 (0.010110??);
0.4*2 = 0.8 (0.0101100?); 0.8*2 = 1.60 (0.01011001????);
0.60*2 = 1.20 (0.010110011???); 0.2*2 = 0.4 (0.0101100110??);
0.4*2 = 0.8 (0.01011001100?); 0.8*2 = 1.60 (0.010110011001?);
DecToBinary(2.0313) = 2.0313*2 = 4.0626 (1?.????); 0.626*2= 1.252 (10.????);
0.252*2 = 0.504; (10.0???); 0.504*2 = 1.008 (10.01??);
0.008*2 = 0.016 (10.010?); 0.016*2 = 0.032 (10.0100???);
0.032*2 = 0.064 (10.01000??); 0.064*2 = 0.128 (10.010000?);
0.128*2 = 0.256 (10.0100000???); 0.256*2 = 0.512 (10.01000000??);
0.512*2 = 1.024 (10.010000001???); or by specs 10.0100….


EDIT3:

More progress. Still having some issues with Decimal->Base7 Conversions:

DecToBin(0.25) = 2^-2 = 0.25 or 0.0100
DecToBin(0.35)=
BinaryToDec(11011.0111) = (2^4)+(2^3)+(0)+(2^1)+(2^0) + (0)+(2^-2)+(2^-3)+(2^-4) = 27.4375
BinaryToDec(111.1011) = (2^2)+(2^1)+(2^0) + (2^-1)+(0)+(2^-3)+(2^-4) = 7.6875
HexToDec(2.08) = (2*16^0) + (0)+(8*16^-2) = 2.03125 or by specs 2.0313
HexToDec(AB.C) = (10*16^1)+(11*16^0) + (12*16^-1) = 171.75 or by specs 171.7500
Base7ToDec(1.2) = (1*7^0)+(2*7-1) = 1.285714286 or by specs 1.2857
Base7ToDec(66.6) = (6*7^1)+(6*7^0) + (6*7^-1) = 48.85714286 or by specs 48.8571

http://cs.furman.edu/digitaldomain/more/ch6/dec_frac_to_bin.htm

DecToBinary(0.25) = 0.25*2 = 0.50 (0.0???); 0.50*2 = 1.00 (0.01??); 00*2 = 0, so answer is 0.0100
DecToBinary(0.35) = 0.35*2 = 0.70 (0.0???); 0.70*2 = 1.4 (0.01??); 0.4*2 = 0.80 (0.010?);
0.80*2 = 1.60 (0.0101????); 0.6*2 = 1.20 (0.01011???); 0.2*2 = 0.4 (0.010110??);
0.4*2 = 0.8 (0.0101100?); 0.8*2 = 1.60 (0.01011001????);
0.60*2 = 1.20 (0.010110011???); 0.2*2 = 0.4 (0.0101100110??);
0.4*2 = 0.8 (0.01011001100?); 0.8*2 = 1.60 (0.010110011001?);
DecToBinary(2.0313) = 2.0313*2 = 4.0626 (1?.????); 0.626*2= 1.252 (10.????);
0.252*2 = 0.504; (10.0???); 0.504*2 = 1.008 (10.01??);
0.008*2 = 0.016 (10.010?); 0.016*2 = 0.032 (10.0100???);
0.032*2 = 0.064 (10.01000??); 0.064*2 = 0.128 (10.010000?);
0.128*2 = 0.256 (10.0100000???); 0.256*2 = 0.512 (10.01000000??);
0.512*2 = 1.024 (10.010000001???); or by specs 10.0100….
DecToBinary(171.7500) = (171) = 128+0+32+0+8+0+2+1 = 10101011.   0.7500*2 = 1.500 (1.1???);
0.500*2 = 1.000 (1.11??) === 10101011.1100;
DecToBinary(1.2857) = 1.2857*2 = 2.5714 (1.????); 0.5714*2 = 1.1428 (1.1???); 0.1428*2 = 0.2856 (1.10??); 0.2856*2 = 0.5712 (1.100?); 0.5712*2 = 1.1424 (1.1001); 0.1424*2 = 0.2848 (1.10010???); 0.2848*2 = 0.5696 (1.100100??); 0.5696*2 = 1.1392 (1.1001001??); 0.1392*2 = 0.2784 (1.10010010…) or by specs 1.1001…
DecToBinary(48.8571) = (48) = 00110000. 0.8571*2 = 1.7142 (0.1????); 0.7142*2 = 1.4284 (0.11???); 0.4284*2 = 0.8568 (0.110??); 0.8568*2 = 1.7136 (0.1101?); 0.7136*2 = 1.4272 (0.11011) ===
110000.11011 or by specs 110000.1101

DecToHex(0.25) = 0.??? = 0.25*16 = 4; (0.4??);
DecToHex(0.35) = 0.??? = 0.35*16 = 5.6 (0.5??); 0.6*16 = 9.6 (0.59???); 0.6*16 = 9.6 (0.599???); === 0.5999999999….. or by specs 0.5999
DecToHex(27.4375) = (27) = 1B; 0.4375*16 = 7; === 1B.7
DecToHex(7.6875) = (7) = 7; 0.6875*16 = 1.375 (7.1??); 0.375*16 = 6 (7.16); === 7.B
DecToHex(1.2857) = (1) = 1; 0.2857*16 = 0.5714 1.492
3A;
DecToHex(48.8571) =48/16 = 3?.????; 0/16 = 0 (30.????);  0.8571*16 = 13.7136 (30.D???); 0.7136*16 = 11.4176 (30.DB???); 0.4175*16 = 6.6816 (30.DB6??); 0.6816*16 = 10.9056 (30.DB6A?); 0.9056*16 = 14.4896 (30.DB6AE?); 0.4896*16 = 7.8336;

DecToBase7(0.25) = 0.??? = 0.25*7 = 1.75 (0.1??); 0.75*7 = 5.25 (0.15??); 0.25*7 = 1.75 (0.151?);


EDIT4:

So, clearly I am doing something wrong with my Decimal to Base7 conversions. I finally found a calculator that accepts fractional decimals, but the only conversion I am coming up correctly with is the bottom row where the Base7 value was already provided:

Can anyone spot what I'm doing wrong in my Math?

DecToBase7(0.25) = (0*7^0)+(2*7^-1)+(5*7^-2) =  (0) + (0.2857142857) + (0.1020408163) = 0.387755102 or by specs 0.3877.
DecToBase7(0.35) = (0*7^0)+(3*7^-1)+(5*7^-2) = (0)+(0.4285714286) + (0.1020408163) = 0.5306122449 or by specs 0.5306.
DecToBase7(27.4375) = (2*7^1)+(7*7^0)+(4*7^-1)+(3*7^-2)+(7*7^-3)+(5*7^-4) = 21.65514369 or by specs 21.6551.
DecToBase7(7.6875) = (7*7^0)+(6*7^-1)+(8*7^-2)+(7*7^-3)+(5*7^-4) = 8.042898792 or by specs 8.0428


EDIT5:

Thanks to everyone who helped me get a better grasp of Decimal/Binary/Hex/Base7 conversions with/without Radix points! I've got the table fully filled out and believe it's close if not all correct. I'll double check later, but for now here is the table and my calculations I used to arrive at the values (hopefully it'll help someone else down the road):

DecToBin(0.25) = 2^-2 = 0.25 or 0.0100
DecToBin(0.35)=
BinaryToDec(11011.0111) = (2^4)+(2^3)+(0)+(2^1)+(2^0) + (0)+(2^-2)+(2^-3)+(2^-4) = 27.4375
BinaryToDec(111.1011) = (2^2)+(2^1)+(2^0) + (2^-1)+(0)+(2^-3)+(2^-4) = 7.6875
HexToDec(2.08) = (2*16^0) + (0)+(8*16^-2) = 2.03125 or by specs 2.0313
HexToDec(AB.C) = (10*16^1)+(11*16^0) + (12*16^-1) = 171.75 or by specs 171.7500
Base7ToDec(1.2) = (1*7^0)+(2*7-1) = 1.285714286 or by specs 1.2857
Base7ToDec(66.6) = (6*7^1)+(6*7^0) + (6*7^-1) = 48.85714286 or by specs 48.8571

DecToBinary(0.25) = 0.25*2 = 0.50 (0.0???); 0.50*2 = 1.00 (0.01??); 00*2 = 0, so answer is 0.0100
DecToBinary(0.35) = 0.35*2 = 0.70 (0.0???); 0.70*2 = 1.4 (0.01??); 0.4*2 = 0.80 (0.010?);
0.80*2 = 1.60 (0.0101????); 0.6*2 = 1.20 (0.01011???); 0.2*2 = 0.4 (0.010110??);
0.4*2 = 0.8 (0.0101100?); 0.8*2 = 1.60 (0.01011001????);
0.60*2 = 1.20 (0.010110011???); 0.2*2 = 0.4 (0.0101100110??);
0.4*2 = 0.8 (0.01011001100?); 0.8*2 = 1.60 (0.010110011001?);
DecToBinary(2.0313) = 2.0313*2 = 4.0626 (1?.????); 0.626*2= 1.252 (10.????);
0.252*2 = 0.504; (10.0???); 0.504*2 = 1.008 (10.01??);
0.008*2 = 0.016 (10.010?); 0.016*2 = 0.032 (10.0100???);
0.032*2 = 0.064 (10.01000??); 0.064*2 = 0.128 (10.010000?);
0.128*2 = 0.256 (10.0100000???); 0.256*2 = 0.512 (10.01000000??);
0.512*2 = 1.024 (10.010000001???); or by specs 10.0100….
DecToBinary(171.7500) = (171) = 128+0+32+0+8+0+2+1 = 10101011.   0.7500*2 = 1.500 (1.1???);
0.500*2 = 1.000 (1.11??) === 10101011.1100;
DecToBinary(1.2857) = 1.2857*2 = 2.5714 (1.????); 0.5714*2 = 1.1428 (1.1???); 0.1428*2 = 0.2856 (1.10??); 0.2856*2 = 0.5712 (1.100?); 0.5712*2 = 1.1424 (1.1001); 0.1424*2 = 0.2848 (1.10010???); 0.2848*2 = 0.5696 (1.100100??); 0.5696*2 = 1.1392 (1.1001001??); 0.1392*2 = 0.2784 (1.10010010…) or by specs 1.1001…
DecToBinary(48.8571) = (48) = 00110000. 0.8571*2 = 1.7142 (0.1????); 0.7142*2 = 1.4284 (0.11???); 0.4284*2 = 0.8568 (0.110??); 0.8568*2 = 1.7136 (0.1101?); 0.7136*2 = 1.4272 (0.11011) ===
110000.11011 or by specs 110000.1101


DecToHex(0.25) = 0.??? = 0.25*16 = 4; (0.4??);
DecToHex(0.35) = 0.??? = 0.35*16 = 5.6 (0.5??); 0.6*16 = 9.6 (0.59???); 0.6*16 = 9.6 (0.599???); === 0.5999999999….. or by specs 0.5999
DecToHex(27.4375) = (27) = 1B; 0.4375*16 = 7; === 1B.7
DecToHex(7.6875) = (7) = 7; 0.6875*16 = 1.375 (7.1??); 0.375*16 = 6 (7.16); === 7.B
DecToHex(1.2857) = (1) = 1; 0.2857*16 = 0.5714 1.492
3A;
DecToHex(48.8571) =48/16 = 3?.????; 0/16 = 0 (30.????);  0.8571*16 = 13.7136 (30.D???); 0.7136*16 = 11.4176 (30.DB???); 0.4175*16 = 6.6816 (30.DB6??); 0.6816*16 = 10.9056 (30.DB6A?); 0.9056*16 = 14.4896 (30.DB6AE?); 0.4896*16 = 7.8336;


To verify Base7 results: http://korn19.ch/coding/base_converter.php

DecToBase7(0.25) = 0.???? = 0.25*7 = 1.75 (0.1???); 0.75*7 = 5.25 (0.15??); 0.25*7 = 1.75 (0.151?); 0.75*7 = 5.25 (0.1515…);
DecToBase7(0.35) = 0.???? = 0.35*7 = 2.45 (0.2???); 0.45*7 = 3.15 (0.23??); 0.15*7 = 1.05 (0.231?); 0.05*7 = 0.35 (0.2310);
DecToBase7(27.4375) = 36.???? = 0.4375*7 = 3.0625 (36.3???); 0.0625*7 = 0.4375 (36.30??); 0.4375*7 = 3.0625 (36.303?); 0.0625*7 = 0.4375 (36.3030);
DecToBase7(7.6875) = 10.???? = 0.6875*7 = 4.8125 (10.4???); 0.8125*7 = 5.6875 (10.45??); 0.6875*7 = 4.8125 (10.454?); 0.8125*7 = 5.6875 (10.4545);
DecToBase7(2.0313) = 2.???? = 0.0313*7 = 0.2191 (2.0???); 0.2191*7 = 1.5337 (2.01??); 0.5337*7 = 3.7359 (2.013?); 0.7359*7 = 5.1513 (2.0135);
DecToBase7(171.7500) = 333.???? = 0.7500*7 = 5.25 (333.5???); 0.25*7 = 1.75 (333.51??); 0.7500*7 = 5.25 (333.515?); 0.25*7 = 1.75 (333.5151);
DecToBase7(1.2857) = 1.???? = 0.2857*7 = 1.9999 (1.1???); 0.9999*7 = 6.9993 (1.16??); 0.9993*7 = 6.9951 (1.166?); 0.9951*7 = 6.9657 (1.1666);

• What is the operation performed as you move left of the radix point? What is the opposite operation called? – Ignacio Vazquez-Abrams Sep 29 '14 at 21:45
• I'm not sure if I know the word you are looking for Ignacio? Are you talking like with Decimal being (ex. 1234.56) being (1*10^4)(2*10^3)(3*10^2)(4*10^1).(5*10^-1)(6*10^-2)? – Analytic Lunatic Sep 29 '14 at 21:49
• Now you're getting it. – Ignacio Vazquez-Abrams Sep 29 '14 at 21:56
• 2^4+2^3+0+2^1+2^0 = 27, not 30 – david Oct 2 '14 at 0:11
• @david, Which conversion specifically are you referring to? – Analytic Lunatic Oct 7 '14 at 20:55

I think I spotted it:

DecToBase7(0.25) = (0*7^0)+(2*7^-1)+(5*7^-2) = (0) + (0.2857142857) + (0.1020408163) = 0.387755102 or by specs 0.3877.

Yes, that is how I convert a 0.25_(base 7) to a base-ten decimal value.

To convert 8.8750_(decimal) to a base-7 value, you need to go the other way:

8.8750_(decimal)                            1
1
.
0.8750_(decimal) * 7 = 6.1250_(decimal) --> 6
0.1250_(decimal) * 7 = 0.8750_(decimal) --> 0
0.8750_(decimal) * 7 = 6.1250_(decimal) --> 6
0.1250_(decimal) * 7 = 0.8750_(decimal) --> 0
0.8750_(decimal) * 7 = 6.1250_(decimal) --> 6
0.1250_(decimal) * 7 = 0.8750_(decimal) --> 0
0.8750_(decimal) * 7 = 6.1250_(decimal) --> 6
...                               ...


So 8.8750_(decimal) is equal to 11.60606060606...(base 7).

With a few special exceptions, converting a fraction in any one base to a fraction in any other base usually leads to such repeating patterns. (Perhaps the most notorious such unexpected repeating pattern happens when converting 0.1_(decimal) to binary. A similar repeating pattern occurs when converting 0.1_(base 3) to decimal).

• Thanks! That cleared it all up. My Edit5 now has my correctly Base7 conversions and all the math for the rest of the table. – Analytic Lunatic Oct 1 '14 at 21:01

You can convert from decimal to other bases with an integer conversion and a right shift.

4 places : *2^4=16 in binary, *2^16=65536 in hex

0.25 * 16 = 4 = b0100 -> shift right by 4 digits -> 0.0100 binary

0.25 * 65536 = 16384 = h4000 -> shift right by 4 digits -> 0.4000 hex

Of course converting between binary and hex is trivial and can be done directly.

To convert to decimal, do the weighted sum of all digits :

bin 1010.1010 = 2^3 + 2^1 + 2^-1 + 2^-3

hex 1020.3040 = 16^3 + 2*16^1 + 3*16^-1 + 4*16^-3

... etc...

Then, you can think about rounding as converting between bases can produce rounding errors. For example, the decimal number 0.1 corresponds in binary to the infinite sequence 0.00011001100110011...

• That's base 7 up there in the question, not base 8. – Ignacio Vazquez-Abrams Sep 29 '14 at 22:22
• I showed binary and hex, not octal. Anyway, using base 7 does not change much : 4 places : 7^4=2401. 0.25 * 2401 = 600. 600= (base7) 1515 so 0.25 = (base7) 0.1515 – TEMLIB Sep 29 '14 at 22:28
• To cheat/check : Try the unix/linux "bc -l" command. Look about the ibase= and obase= commands. – TEMLIB Sep 29 '14 at 22:29
• @Temlib, so where I'm taking Binary to Dec, 11011.0111 = 2^4+2^3+0+2^1+2^0 . 0+2^-2+2^-3+2^-4 = 30.4375 and 111.1011 = 2^2+2^1+2^0 . +2^-1+0+2^-3+2^-4 = 7.6875? Or did I miss something there? – Analytic Lunatic Sep 30 '14 at 1:24
• That's the idea, except that 16+8+2+1+1/4+1/8+1/16=27.4375, instead of 30.4375... ;-) – TEMLIB Sep 30 '14 at 1:46

You can deal with fractional numbers by treating the numbers to the right of the Radix as negative powers.

Taking binary as an example using 2.4 notation (i.e. 6 bit number; 2 integer bits; 4 fractional bits:

2^1, 2^0 . 2^(-1), 2^(-2), 2^(-3), 2^(-4)

so: 3.5625(d) = 2+1+.5+0.0625 = 11.1001(b)

etc... for all the other bases e.g. 16^1,16^0 . 16^(-1),16^(-2) etc...

Taking 7 as the base (i.e): 7^1, 7^0 . 7^(-1), 7^(-2).....

so: 16+1/7 (d)= 22.1 i.e. 2*7^1 + 2*7^0 + 1*7^(-1)

• Thanks for the response akellyirl! Can you do a few examples of Decimal to Base7? (See my most recent Edit). I think I've got most of the kinks figured out with everything but that (not finding any online calculators to verify my results are correct or way out in the wrong ballfield for Base7). – Analytic Lunatic Oct 1 '14 at 3:28
• @AnalyticLunatic done. – akellyirl Oct 1 '14 at 11:19
• thanks again. I thought I had it down, but as can be seen in my EDIT4 above, based off the calculator I found I am doing something wrong. Do you spy where I may be going wrong with the calculation? – Analytic Lunatic Oct 1 '14 at 14:19
• @AnalyticLunatic your DecToBase7() calculations are Base7-to-Dec e.g. DecToBase7(0.25) = (0*7^0)+(2*7^-1)+(5*7^-2) is 0.25 (base7) to Decimal. Also 7.6875 is not possible as a base 7 number because only 0 to 6 exists before a carry. – akellyirl Oct 1 '14 at 19:05
• Hmm... maybe I displayed it backwards(?), but I was representing the operation as I would in naming a program subroutine, taking the Decimal value 0.25 to Base7 thus being DecToBase7(0.25), in theory passing in the 0.25 Decimal value to return as a Base7 number. As for you mentioned 7.6875 not being possible as Base7, I'm not sure I follow? In my Edit5 I believe I have got it correct now...? – Analytic Lunatic Oct 1 '14 at 20:59