Encoding numeric data

The most common way to encode numeric data is using binary numbers. If you are unfamiliar with or need a brush up on binary numbers, study this handout before continuing.

Let's take an example -- how would we encode the number 35? Converting 3510 to binary, we get 100101. (Double check that before reading on).

That is all there is to it -- we encode the number 35 as bits 100101.

If the number 35 were stored in a byte of memory, that byte would contain these 8 bits: 00100101.

We have been speaking of integral numbers. Floating point numbers -- those with decimal points -- are typically encoded as two binary numbers, one representing the value and the other the location of the decimal point, but we will leave the details for another time.

Resources


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.