LN2-DataRep

# LN2-DataRep - FIT1001 Computer Systems Lecture Notes 2 Data...

This preview shows pages 1–4. Sign up to view the full content.

1 www.monash.edu.au www.monash.edu.au FIT1001- Computer Systems Lecture Notes 2 Data Representation and Computer Arithmetic LN 2: FIT1001 Computer Systems 3 LN 2: Learning Objectives Number systems Methods of storage used for binary data Representation of integer, floating point and character data Conversion methods for integer, signed integer and floating-point numbers Basic mathematical operations on signed integer and floating-point numbers www.monash.edu.au Number Systems

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 LN 2: FIT1001 Computer Systems 5 Binary and Decimal Binary number system (base 2) uses powers of 2 for each position in a number Decimal number system (base 10) uses powers of 10 for each position in a number Any integer quantity can be represented exactly using any base (or radix) – The decimal integer 947 in powers of 10: > 9 × 10 2 + 4 × 10 1 + 7 × 10 0 – The binary number 11001 in powers of 2 is: > 1 × 2 4 + 1 × 2 3 + 0 × 2 2 + 0 × 2 1 + 1 × 2 0 > 16 + 8 + 0 + 0 + 1 = 25 When the radix is something other than 10, the base is denoted by a subscript – 11001 2 = 25 10 (Sometimes, the subscript 10 is added for emphasis) LN 2: FIT1001 Computer Systems 6 Octal and Hexadecimal Octal (base 8) – uses 8 symbols 0, 1, 2, 3, 4, 5, 6 and 7 to denote values from 0 to 7 Hexadecimal (base 16) – uses 16 symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F to denote values from 0 to 15 – represents a shorthand version of binary numbers – Example: 15528 10 = 3CA8 16 Base-2 and base-16 number systems enable you to understand the operation of computer components and the design of instruction set architectures LN 2: FIT1001 Computer Systems 7 Binary, Hexadecimal and Octal It is easy to convert between base 2 and base 16 base 2 and base 8 To convert from binary to hexadecimal Group the binary digits into groups of four > From right to left for integer part / left to right for fraction part > Important to pad out with 0’s (to avoid errors) Example: convert the binary number 11010100011011 2 (= 13595 10 ) to hexadecimal To convert from binary to octal Group the binary digits into groups of three > From right to left for integer part / left to right for fraction part > Important to pad out with 0’s (to avoid errors) Example: convert the binary number 11010100011011 2 to octal LN 2: FIT1001 Computer Systems 8 Binary Number System: Integers Uses 2 symbols: 0 and 1 Highest digit is 2-1 Example: the binary number 11001 in powers of 2 is: – 1 × 2 4 + 1 × 2 3 + 0 × 2 2 + 0 × 2 1 + 1 × 2 0 = 25 The powers of 2 increase from right to left A simple algorithm for calculating the successive binary digits of a decimal integer X: Start from the right hand end: > Repeat – Get the remainder from dividing X by 2 – Divide X by 2 and put the result in X > until X is zero (the quotient = 0) The remainders in reverse order are the binary value Example: Calculate the binary digits for X = 43 10
3 LN 2: FIT1001 Computer Systems 9 Binary Number System: Fractions (I) Binary fractions involve descending powers of 2 A simple algorithm for calculating the successive binary

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern