Translating between bases.

By Dr. Nicholas Duchon

Copyright 2008


Outline:

Integers Fractions Negative Integers IEEE 754
Base 10
Base b representation
Conversion from b to 10
Conversion from 10 to b
Conversion from b to c
b = 2 - binary
b = 8 - octal
b = 16 - hexadecimal
Base 10
Base b
Conversion from b to 10
Conversion from 10 to b
b = 2 - binary
b = 8 - octal
b = 16 - hexadecimal
Signed
Complements (b's, b-1's)
Excess
Conversion to base 10
Conversion from base 10
Summary algorithm
Special Cases
IEEE-754 Floating Point Converter


1. Integers

There are a variety of ways to represent numbers, but the one we are considering in this presentation is the place-holder system developed by the Hindus with the explicit use of 0. To understand the motivation for this kind of number system, we go back to grade school and remind you of how the base 10 number system was originally presented:

4825 means 4 1000's plus 8 hundreds plus 2 tens plus 5 ones.

1.1 Base 10

Since we have seen exponentials since then, we can rewrite this expression as follows:

4825 = 4*103 + 8*102 + 2*101 + 5*100

Now we will make a very useful observation about the modulus operator (%). Recall that this is the remainder when we divide one number by another. For example:

38 % 5 = 3

Because 38 = 7*5 + 3, or 5 goes into 38 7 times, with a remainder of 3.

Now, let's return to the number we started with, 4825. We create a table of remainders of this number by powers of 10, and observe what happens when we apply integer division to the remainders.
In the calculations that follow we will be using integer division, where the remainder, the fractional part, is discarded. For example, 38 / 7 = 5.

Expression
Power of 10
Remainder
Remainder/10n expression
Result
Powers of 10 for emphasis!
4825 % 10
0
5
5 / 100
5
100 = 1
4825 % 100
1
25
25 / 101 2
101 = 10
4825 % 1,000
2
825
825 / 102 8
102 = 100
4825 % 10,000
3
4825
4825 / 103 4
103 = 1,000
4825 % 100,000
4
4825
4825 / 104 0
104 = 10,000

Looking at the final 2 columns, we see the breakdown of 4825 into 4 1,000's, 8 100's, 2 10's and 5 1's. Notice that once we have reached the 104 row, the result is 0, and will continue to be 0 from that point on. This is related to the fact that leading 0's are generally suppressed in place-holder notation.

Before we go on, we make one more observation: in the above table, we could simply have dropped the remainders as we go along in a chained (recursive) fashion, as shown below:

Remainder
Division
Power of 10
Result
Powers of 10 for emphasis!
4825 % 10
4825 / 10 = 482
0
5
100 = 1
482 % 10
482 / 10 = 48
1
2
101 = 10
48 % 10
48 / 10 = 4
2
8
102 = 100
4 % 10
4 / 10 = 0
3
4
103 = 1,000
0 % 10
0 / 10 = 0
4
0
104 = 10,000

And finally if we understand what we are doing, we can present the entire process in the very simple table below:

Computing target base 10
Number / 10 each step
Remainder % 10 each step
4825
5
482
2
48
8
4
4
0
0

It is tempting to say that the number is read from bottom-to-top = left-to-right, it is probably more intuitively correct to think of reading the number from top-to-bottom = 1's place to 10's place, etc = from right (the 1's position)-to-left (a higher power of 10 each time).

1.2 Base b representation

I took the time in the base 10 example above to motivate the key elements of other bases. Let's start with a generalized number base b - the notation is ugly, but the concepts are the same as we have seen in the base 10 representation.

x = anbn + an-1bn-1 + an-2bn-2 + ... + a3b3 + a2b2 + a1b1 + a0b0

What's with the ai's? Well, this is just a convenient notation when we don't know exactly how many variables we need, but they should correspond to something else. In this case, the something else is the corresponding power of the base, bi. Also, in the place-holder notation, we want all of the ai's to be integers less than b, and non-negative (≥ 0). For example, if b is 10, ai ∈ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. If b is 2, ai ∈ {0, 1}.

Here are a few examples:
Base
Number
Expression
2
100101
1*25 + 0*24 + 0*23 + 1*22 + 0*21 + 1*20
8
3702
3*83 + 7*82 + 0*81 + 2*80
16
F2A6
15*163 + 2*162 + 10*161 + 6*160
23
GM2K04
16*235 + 22*234 + 2*233 + 20*232 + 0*231 + 4*230

A symbol to value table when we need symbols for values larger than 9 to represent digits in bases larger than 10:
Symbol
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Value
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

1.3 Conversion from b to 10

I think after looking at the examples table in the previous section, the conversion to base 10 should be pretty obvious:

Base
Number
Expression
Base 10
2
100101
1*25 + 0*24 + 0*23 + 1*22 + 0*21 + 1*20
37
8
3702
3*83 + 7*82 + 0*81 + 2*80
1,986
16
F2A6
15*163 + 2*162 + 10*161 + 6*160
62,118
23
GM2K04
16*235 + 22*234 + 2*233 + 20*232 + 0*231 + 4*230
109,172,908

You can get the last number using the MS Windows calculator in Scientific mode. 235 is a rather large number, but is within the range of the calculator.

1.4 Conversion from 10 to b

Converting from base 10 to base b is more difficult only because we (most of us, anyway) have a very hard time doing arithmetic base b. For example, to convert 63810 to base 2, we would need to perform calculations base 2 - notice that we have represented the digits 6, 3 and 8 in base 2 also:

Base 10
EVERYTHING on this side is base 2, including the exponents!
638
110*101010 + 11*10101 + 1000*10100

Well - this doesn't look very promising, unless you're a computer used to doing binary arithmetic. So how would a normal human go about this problem without going crazy first? If we look back at the calculations in the first part of this presentation, we see a hint - try integer divisions and remainders!

Let me present the base 23 example because once you see how the algorithm works there, I think you will be able to follow the algorithm in more familiar bases.

The problem then is to convert 109,172,908 base 10 to base 23.

Let's begin by working with the expression representation, so we see what is going on:

Expression / 23
Result % 23
Base 23 digit
(16*235 + 22*234 + 2*233 + 20*232 + 0*231 + 4*230) / 23
4
4
(16*234 + 22*233 + 2*232 + 20*231 + 0*230) / 23 0
0
(16*233 + 22*232 + 2*231 + 20*230) / 23 20
K
(16*232 + 22*231 + 2*230) / 23 2
2
(16*231 + 22*230) / 23 22
M
(16*230) / 23 16
G
0 / 23
0
0

You can do this calculation using the MS Calculator using the "Mod" and "Int" buttons, along with the / and MS and MR to save and recall the intermediate results.

Working with the calculator, we get the following intermediate results, using the "Int" button to get rid of the fractional parts.

Number / 23
Result % 23
Base 23 digit
109,172,908 / 23
4
4
4,746,648 / 23 0
0
206,376 / 23 20
K
8,972 / 23 2
2
390 / 23 22
M
16 / 23 16
G
0 / 23
0
0

In each step:
  1. MS - save the current value
  2. Mod 23 - get the remainder and write it down
  3. MR - recall the saved value
  4. / 23 - compute the next value
  5. Int - get rid of the fractional part
  6. If the result is not 0, go back to step 1

1.5 Conversion from b to c - note bases 2, 8, 16

As we saw in the example with direct conversions to binary, a direct conversion from base b to base c involves doing a lot of arithmetic base c. I don't recommend this approach. Go to base 10 first.

Special cases: The bases that are powers of 2 are easy to convert by ungrouping digits to base 2, then regrouping them to another base which is a power of base 2.

Thus, converting from base 16 (groups of 4 binary digits per hex digit) to base 8 (groups of 3 binary digits per octal digit) is easy:

F,2A616 = 1111,0010,1010,01102 = 1,111,001,010,100,1102 = 171,2468

Now that we have done an example with a really hard base, 23, we should be able to handle the smaller, easier, bases, such as 2, 8 and 16, without too much trouble.

1.6 b = 2 - binary

I will just do an example - I think it should be enough by now:

Convert 48334 to binary. We need to /2 and %2:

Computing target base 2
base 10 / 2
Remainder % 2
48334
0
24167
1
12083
1
6041
1
3020
0
1510
0
755
1
377
1
188
0
94
0
47
1
23
1
11
1
5
1
2
0
1
1
0
0

4833410 = 1011,1100,1100,11102

I colored the table to make it easier to group the binary digits.

1.7 b = 8 - octal

Since we already computed the answer base 2, we can get the conversion of 48334 to base 8 just by regrouping the digits:
1,011,110,011,001,1102 = 136,3168

Using the divide/remainder method:

Computing target base 8
base 10 / 8
Remainder % 8
48334
6
6,041
1
755
3
94
6
11
3
1
1

1.8 b = 16 - hexadecimal

Since we already computed the answer base 2, we can get the conversion of 48334 to base 16 just by regrouping the digits:
1011,1100,1100,11102 = BCCE16

Using the divide/remainder method:

Computing target base 16
base 10 / 16
Remainder % 16
Hex digit
48334
14
E
3,020
12
C
188
12
C
11
11
B
0
0
0


2 Fractions

Now on to fractions. These are more difficult in all bases. Let's consider some examples base 10:

Fraction
Base 10
Expression
Comments
3/10
0.3
3*10-1
Easy, finite
53/100
0.53
5*10-1 + 3*10-2
Pretty easy still
8591/10000
0.8591
8*10-1 + 5*10-2 + 9*10-3 + 1*10-4
More numbers, same pattern
3/5
0.6
6*10-1
Make the denominator a multiple of 10 first
7/25
0.28
2*10-1 + 8*10-2
Same pattern
1/3
0.3333...
3*10-1 + 3*10-2 + 3*10-3 +... A finite fraction, but an infinite decimal expansion
7/13
0.538461,538461,538461...
5*10-1 + 3*10-2 + 8*10-3 + ...
This repeats after a while - as will ALL quotients of 2 integers.
3/4
0.75
7*10-1 + 5*10-2
A power of 2 as a denominator
3/8
0.375
3*10-1 + 7*10-2 + 5*10-3
23 as a denominator


2.1 Base 10

As with the integral base 10 conversions, let's see if we can find a pattern. In the base 10 integer case, we were interested in the multipliers of the 10n terms. Here, we want to do the same kind of thing, but n is negative, so rather than dividing by 10, perhaps we should try dividing by 1/10 and where before we worked /10 and %10 to get the multiplier and ignore the higher terms, we might try *10 and taking the integer part to get rid of the LOWER terms. Let's work out an example:

A calculation of 0.8591 base 10
Expression
Power of 10
Remainder
Part of Expression
Integer Part
Powers of 10 for emphasis!
0.8591 * 10
-1
0.591
8 / 10-1
8
10-1 = 0.1
0.591 * 10
-2
0.91
  5 / 10-2 5
10-2 = 0.01
0.91 * 10
-3
0.1
   9 / 10-3 9
10-3 = 0.001
0.1 * 10
-4
0
1 / 10-4 1
10-4 = 0.000,1
0
-5
0
0 / 10-5 0
10-5 = 0.000,01

2.2 Base b

Base b is same as base 10, and we have essentially the same notation as we had for base b integers above, except that now the exponents are negtive, and they may go on forever:

x = a-1b-1 + a-2b-2 + a-3b-3 + a-4b-4 + ...

Now, we use negative numbers for the indices of the a coefficients (multipliers), again just for convenience.

Here are a few examples:
Base
Number
Expression
2
0.100101
1*2-1 + 0*2-2 + 0*2-3 + 1*2-4 + 1*2-5 + 1*2-6
8
0.3702
3*8-1 + 7*8-2 + 0*8-3 + 2*8-4
16
0.F2A6
15*16-1 + 2*16-2 + 10*16-3 + 6*16-4
23
0.GM2K04
16*23-1 + 22*23-2 + 2*23-3 + 20*23-4 + 0*23-5 + 4*23-6

2.3 Conversion from b to 10

Again, the conversion from base b to base 10 is relatively easy, particularly once we see how the representation works from the table above. For example:

0.37028
= 3*8-1 + 7*8-2 + 0*8-3 + 2*8-4 // really any base, but base 10 say
= 3*0.125 + 7*0.015625 + 0*0.001953125 + 2*0.000244140625 // base 10 here
= 0.48486328125

Another way to approach this:
0.37028
= 0.37028 * 10008 / 10008
= 37028 / 10008
{ and now convert this equation to base 10 }
= (3*83 + 7*82 + 0*81 + 2*80) / 84
= (3*512 + 7*64 + 0*8 + 2) / 4096
= 1986 / 4096
= 993 / 2048
= 0.48486328125
{ using the MS Calculator as a check }

Using colors in the above to highlight the difference in bases: the red base 8, the green base 10.

With other bases, things can get interesting, and one typically gets repeating decimals even though the representation in the original base was finite, using the second method:

0.256
= 256 / 1006
= (2*61 + 5*60) / 1006

= (12 + 5) / 62 { converting to base 10 }
= 17 / 36
= 0.4722222... { using the calculator }


And finally, a hard example:

0.420637
= 420637 / 1000007
= (4*74 + 2*73 + 6*71 + 3) / 75

= (4*2401 + 2*343 + 6*7 + 3) / 16807
= 10335 / 16807
= 0.61492235378116261081692152079491... (approximately)


2.4 Conversion from 10 to b

Following the example we used in base 10, the algorithm is to multiply by b, strip the integer part as the digit, and continue with the fractional part.

Let's start with a simple conversion: 0.2810 to base 5.

A conversion of 0.28 base 10 to base 5
Expression
Power of 5
Part of Expression
Integer Part
Powers of 5 for emphasis!
0.28 * 5




1 + 0.4 * 5
-1
1 / 5-1
1 5-1 = 0.1
2 + 0.0
-2
  2 / 5-2 2
5-2 = 0.01
0
-3
   0 / 5-3 0
5-3 = 0.001
Thus:
0.2810
= 0.125
= 1/5 + 2/25 { base 10 }
= 2/10 + 8/100 { base 10 }

How about 17/36 = 0.47222...10 to base 6? We already know the answer should be 0.256, so let's see how our algorithm works on this number:

A conversion of 0.47222... base 10 to base 6
Expression
Power of 6
Part of Expression
Integer Part
Powers of 6 for emphasis!
0.47222... * 6




2 + 0.833... * 6
-1
2 / 6-1
2 6-1 = 0.1
4 + 0.999...
= 5 + 0.0 * 6
-2
  5 / 6-2 5
6-2 = 0.01
0
-3
   0 / 6-3 0
6-3 = 0.001

Nice. Just one key point here: in base 10, 0.9999.... = 1. In fact, in base n, if we call k = n-1, then 0.kkkkk...n = 1n.
So, 0.555556 = 16 and 0.FFF....16 = 116..

2.5 b = 2 - binary

Now, let's try to apply what we have seen so far to base 2, with little writing:

Convert 0.6757812510 to base 2 - this example is rather contrived, as you will see:

Number
Digit base 2
0.67578125
-
1.3515625
1
0.703125
0
1.40625
1
0.8125
0
1.625
1
1.25
1
0.5
0
1.0
1

So:
0.6757812510
= 0.101011012
= 10101101 / 28
= (128 + 32 + 8 + 4 + 1) / 256 { base 10 now }
= 173 / 256 { check with your calculator! }

Convert 0.377 to base 2:

Number
Digit base 2
0.377
-
0.754
0
1.508
1
1.016
1
0.032
0
0.064
0
0.128
0
0.256
0
0.512
0
1.024
1
0.048
0

This goes on, but we do get an approximation:
0.37710 = 0.0110000010...2

2.6 b = 8 - octal

According to one approach, we should be able to convert from base 2 to base 8 simply by forming groups of 3 binary digits and replacing the triplets with the corresponding octal digit.

We already know:
0.6757812510
= 0.101011012
= 0.101,011,0102
= 0.5328 { ? }

Notice that we needed to add a TRAILING 0 to get the triplets. It looks like this might be ok, but let's see if the base 10 to base 8 conversion algorithm gives us the same answer:

Number - *8
Digit base 8
0.6757812510 -
5.40625
5
3.25
3
2.0
2

It worked!

2.7 b = 16 - hexadecimal

Now let's try the same trick base 16:

0.6757812510
= 0.101011012
= 0.1010,11012
= 0.AD16 { ? }


Number - *16
Digit base 16
0.6757812510 -
10.8125
A
13.0
D

It worked!


3. Negative Integers

Representing negative numbers is not such a big problem until you want to do calculations with them. Multiplying is easy, just think of negative numbers as positive numbers multiplied by -1, multiply the positive parts together normally, and count how many -1's are involved - if an even number of -1's, the result is positive, otherwise the result is negative. For example:
-2 * 3 * -4 * -5 = (-1)(-1)(-1) * 2*3*4*5 = -120

However, adding numbers that are mixed together is more complicated, and is normally done using a rather complicated set of rules - Let's call the numbers A and B:
  1. If both numbers are positive, just do the regular addition.
  2. If both are negative, add the absolute values as in regular addition, and take the negative of the result.
  3. If A and B have opposite signs, then we have cases:
    1. If |A| < |B|, compute |B| - |A| and then:
      1. if A < 0, the result is positive
      2. else the result is negative
    2. Else, compute |A| - |B|
      1. if A < 0, the result is negative
      2. else the result of positive
Here are a few examples:
a.i
a.ii
b.i
b.ii
-12
+17
-----
5
12
+ -17
-----
-5
-17
+12
----
-5
17
+ -12
-----
5

3.1 Signed

The situation is exactly the same in any base, including base 2, so we see that handling arithmetic using signed magnitude is going to be a mess. Is there a better way? Actually, yes, IF we specify the number of digits in the representation.

3.2 N-digit Complements (b's, b-1's)

Let's start working with base 10, just because the numbers are more familiar. The simple representation of a negative number is to just take every digit and subtract from 9. This is called 9's complement. Let's take a look at representing the numbers in the above example using 5-digit 9's complement:

Signed base 10
5-digit 9's complement
-12
00012 --> 99987

Notice that if we add 12 to -12, we should get 0, but in 9's complement this is what happens:
  00012
+ 99987  { 5-digit 9's complement representation of -12 }
----------
  99999

This means that we need to make a special note that 99999 is a representation for 0 - bummer!

But if we just added 1 to the 9's complement, the arithmetic becomes:
  00012
+ 99988  { 5-digit 10's complement representation of -12 }
----------
  00000  { drop the overflow digit! }


(N:b) N-digit b's complement - this is not standard notation, but as far as I know, there is no common standard notation for this, so I'll go with this. By now, you should be convinced that one MUST specify not only the b in b's complement, but the number of digits (N), and that to perform arithmetic in N-digit b's complement, all the numbers must be represented using N digits.

Another critical point about N-digit b's complement is that since there are only a finite number of digits, this system can only represent a FINITE number of integers. Thus, 10-digit 7's complement can only represent 710 values, one more negative value than number of positive values, since in this case 6,666,666,666 + 1 = 0,000,000,000.

In these systems, if the left-most digit is less than b/2 the number is positive, otherwise the number is negative.

In base 2, this means that any number whose left-most digit is 0 is positive, and a left-most digit of 1 means the number is negative.

Doing the above problem (-12 + 17) in 10-bit 2's complement works as follows:
  1210 =         11002     = 00 0000 1100 (10:2)
-1210 = 11 1111 00112 + 1 = 11 1111 0100 (10:2)

Base 10
10-digit 2's complement (10:2)
-12
+ 12
------
0
11 1111 0100
00 0000 1100
--------------
00 0000 0000

Let's try another problem (-12 + 17) in 10-bit 2's complement works as follows:
 1210 =         11002     = 00 0000 1100 (10:2)
-1210 = 11 1111 00112 + 1 = 11 1111 0100 (10:2)
 1710 =         00112     = 00 0001 0001 (10:2)

Base 10
10-digit 2's complement (10:2)
-12
+ 17
------
5
11 1111 0100
00 0001 0001
--------------
00 0000 0101

3.3 Excess

Just one more item before we get to the IEEE floating point representation of numbers: the excess system. In these systems, a number is added to all numbers.

Let's take a simple case, 3-digit excess 100 base 10. Now we can represent numbers in the range -100 to 899. What about arithmetic? A simple observation tells us how it should work:
A + 100 + B + 100 = A + B + 200
Thus, after we just add, we need to subtract 100, OR we could subtract 100 from each number before we do the subtraction. This just looks painful, so why bother?

The reason is that there are a few places where the common operation is adding 1's to the smaller of two numbers until they are the same.

Thus, if A = -8 and B = 3, then using 3-digit excess 100 base 10, we do the following:
092 = A, 103 = B
092 --> 093 --> 094 --> 095 --> 096 --> 097 --> 098 --> 099 --> 100 --> 101 --> 102 --> 103

This took 11 steps - which is just 103-092. At the moment, this is pretty thin motivation, but this is exactly the operation used in IEEE 754 when 2 floating point numbers need to be added.


4. IEEE 754

Warning: this is COMPLICATED! Just about everybody looks at this system and concludes that either they are stupid or this is complicated - so I have to emphasize that this system takes a lot of work to just understand, much less get some feel for how anyone would come up with this system. Just hang in there - understanding comes with practice.

This calculator is a really big help in checking 754 representations and conversions, and it is a real help in understanding how the representation works:

Reference:
Harald Schmidt
Euskirchener Str. 43
53121 Bonn - Germany
E-mail:web@h-schmidt.net
IEEE 754 is actually at least 2 different number representation systems, one using 32 bits and the other 64 bits. We will focus on the 32-bit version.

We begin with base-10 scientific notation because at least 754 is "like" scientific notation.
Number
Scientific Notation
Characteristic
= power
Mantissa
= fractional part
= significand
6.4323
6.4323 x 100
0
6.4323
5,6140.338
5.6140338 x 104
4
5.6140338
-0.00002343
-2.343 x 10-5
-5
-2.343

We see that there are number of fields that we need to define scientific notation: the sign of the number, the mantissa (this number times some power of 10 until the result is less than 10 and greater than or equal to 1), the exponent and the sign of the exponent.

Doing all this in base 2 has the same issues, but there are clever things that can be done to increase the precision with a given number of bits. In particular, if we insist the mantissa be >= 12 and < 102, the only possible value for the first bit is 1. Now we are ready to describe how the 32 bits are used:

bit 31
bits 30-23
bit 22-0
sign bit
exponential part
excess 127
mantissa
bit 22 is the 2-1 bit
the 20 bit is always 1 and not represented explicitly

To subtract 127 in 8-bits, add 1000,0001 using the 2's complement arithmetic, since in (8:2):
12710 = 0111,1112
-12710 = 1000,00002 + 1 = 1000,0001 (8:2)

4.1 754 to base 10

Let's do an example:
0,1000,0100,1011,0000,0000,0000,0000,000

Interpretation:

4.2 Base 10 to 754

Let's do a contrived but interesting number: 27056.812510
To limit the suspense, the answer should be:
So, how do we get there from here?

We begin by converting the entire number to base 2, using the techniques we have seen so far, in 2 parts: the integer part and the fractional part:
The integer part
Expression / 2
Result % 2
27056
0
13528
0
6764
0
3382
0
1691
1
845
1
422
0
211
1
105
1
52
0
26
0
13
1
6
0
3
1
1
1
So the integer part is:
Now for the fractional part
Expression * 2
Result
0.8125

1.6250
1
1.250
1
0.5
0
1
1
So the fractional part is:
And the total number base 2 is:
Now we need to move the binary point so that all of the red stuff is to the right, the binary version of scientific notation:
So we now have the "real" exponent, but to use the 754 format, we need to add 127 and convert to binary:
And putting it all together:

4.3 Summarizing:

  1. Start with a decimal fraction (base 10)
  2. Take the absolute value, and save the sign for the initial sign bit of the 754 format
  3. Convert the integer part to base 2
  4. Convert the fractional part to base 2
  5. Put the two parts together
  6. Move the binary point to make the number >= 1 and < 102 , creating the base 2 version of scientific notation.
  7. Compute the 754 exponent by adding 127 (0111,11112) to the real exponent
  8. Put it all together: sign bit + excess 127 exponent + fractional part of the base 2 scientific notation (drop the initial 1)

4.4 Special cases:

  1. If the exponent becomes 0000,0000 the "initial 1" assumption is dropped, allowing for even smaller numbers to be represented.
  2. 0 --> 0,0000,0000,0000,0000,0000,0000,0000,000
  3. -0 --> 1,0000,0000,0000,0000,0000,0000,0000,000
  4. NaN (not a number) --> 0,1111,1111,1000,0000,0000,0000,0000,000
  5. Infinity --> 0,1111,1111,0000,0000,0000,0000,0000,000
  6. -Infinity --> 1,1111,1111,0000,0000,0000,0000,0000,000