| Integers | |||||||||||||
| So far, we've seen how to convert numbers between bases. | |||||||||||||
| How do we represent particular kinds of data in a certain (32-bit) architecture? | |||||||||||||
| We will consider | |||||||||||||
| integers | |||||||||||||
| floating point | |||||||||||||
| characters | |||||||||||||
| What do we know about integers? | |||||||||||||
| They can be represented in binary using the digits (bits) 0 or 1 | |||||||||||||
| The value N can be represented using K bits. | |||||||||||||
| K = ceil (lg N) | |||||||||||||
| Suppose we have 32 bits. | |||||||||||||
| Then our numbers will be of the form | |||||||||||||
| i = 31 | |||||||||||||
| N = | sum (bi * 2i) | where bi = 0 or 1 | |||||||||||
| i = 0 | |||||||||||||
| This is called unsigned binary representation. | |||||||||||||