Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Note that the methods we used to convert from decimal.

Slides:



Advertisements
Similar presentations
NUMBER SYSTEM. How to convert hexadecimal numbers to decimal numbers? 230 Working from right to left, MULTIPLY each position with 8 raised to the power.
Advertisements

John Owen, Rockport Fulton HS
DATA REPRESENTATION CONVERSION.
Number System Conversions Lecture L2.2 Section 2.3.
Converting Binary to Octal
Number Systems and Arithmetic
© Copyright 2000 Indiana University Board of Trustees Proficiency Quiz Study Guide Note: The following slides are provided courtesy of Dr. Bob Orr (Computer.
2.1 2 Number Systems Foundations of Computer Science  Cengage Learning.
 Binary Binary  Binary Number System Binary Number System  Binary to Decimal Binary to Decimal  Decimal to Binary Decimal to Binary  Octal and Hexadecimal.
Number Systems.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Strings Do we need to convert integers (or longs, or floats) to strings.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes There was one other problem with bytes: Compatibility Compatibility.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Chapter 2 Basic Data Types.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits and Bytes How Many bits (or ‘doughnuts’) do we really need? Good question!
Supplemental Chapter Number Bases
NUMBER SYSTEM.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Floating-Point (real) numbers Consider the Number:4,
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Remember when we first talked about the different combinations.
Number systems, Operations, and Codes
Number Base Conversions
Converting From decimal to Binary & Hexadecimal to Binary
Digital Electronics Octal & Hexadecimal Number Systems.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Characters vs. Numbers Adding in Binary: There are only.
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
1 Computer Science LESSON 1 on Number Bases. 2 Objective In this lesson you’ll learn about different Number Bases, specifically about those used by the.
DECIMALBINARY a) b) c) d) e) f) Revision Exercise DECIMALBINARY a) b) c)
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
Discrete Mathematics Numbering System.
CEC 220 Digital Circuit Design Number Systems & Conversions Friday, January 9 CEC 220 Digital Circuit Design Slide 1 of 16.
Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x, /.
Octal & Hexadecimal Number Systems
NUMBER SYSTEM. Number System Number Base B => B symbols – Base 16(Hexa):0, 1,……9, A,…, E, F – Base 10 (Decimal): 0, 1, 2,……, 7, 8, 9 – Base 8(Octal):
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Positive Integers Dale Roberts,
CEC 220 Digital Circuit Design Number Systems & Conversions Wednesday, Aug 26 CEC 220 Digital Circuit Design Slide 1 of 16.
Number Systems. Topics  The Decimal Number System  The Binary Number System  Converting from Binary to Decimal  Converting from Decimal to Binary.
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Computer Studies Today Chapter 19 1 Chapter 19. Computer Studies Today Chapter 19 2 »Information stored in a computer is in two states: –ON –OFF.
Cis303a_chapt03_exam1_answer.ppt CIS303A: System Architecture Exam 1: Chapter 3 Answer List the characters (digits) for the following bases. 1) Decimal:
CSC 110 – Intro to Computing Lecture 3: Converting between bases & Arithmetic in other bases.
The Hexadecimal System is base 16. It is a shorthand method for representing the 8-bit bytes that are stored in the computer system. This system was chosen.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Bits & Bytes OR OffOn Bit = Binary Digit (or Binary Digit) = {0, 1} Bits.
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr.
Chapter 32 Binary Number System. Objectives After completing this chapter, you will be able to: –Describe the binary number system –Identify the place.
Coding Part 2. Weight of the Digit 3672 Thousands (10 3 )Hundreds (10 2 )Tens (10 1 )Units (1) = Weights Decimal Example (3672) 10 Binary.
Lecturer: Santokh Singh
Positional Number Systems Decimal, Binary, Octal and Hexadecimal Numbers Wakerly Section
Digital Design Chapter One Digital Systems and Binary Numbers
Octal to Decimal Decimal Octal Binary Hexadecimal.
Discrete Mathematics Numbering System.
By: Jonathan O. Cabriana
Computer Science LESSON 1 on Number Bases.
Octal & Hexadecimal Number Systems
Base ‘b’ number for i = 0 to n – 1 for an n digit quantity
Octal & Hexadecimal Number Systems
Location in course textbook
Number System conversions
Octal & Hexadecimal Number Systems
Binary Quiz UIN: ____________________
Number Systems and Binary Arithmetic
Introduction to IT By: Muhammed s. anwar.
Binary, Octal and Hex Numbers Copyright Thaddeus Konar
Binary, Octal and Hex Numbers Copyright Thaddeus Konar
Digital Electronics and Microprocessors
AP Computer Science LESSON 1 on Number Bases.
John Owen, Rockport Fulton HS
Numeral systems (radix)
Computer Science 1 Review and finish Number base conversion
Information Representation
Course Code 114 Introduction to Computer Science
Presentation transcript:

Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Note that the methods we used to convert from decimal to binary, and back again, work for any base. If, for example we wished to convert to Octal (base 8): Remainder Since the new quotient is 0, collect from last to first =134 8 Check: Number: Position: Value: 1* * * 8 0 = 1* * * 1 = = 92 Octal/Hexadecimal

Page 2 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Why would I care about octal (base 8) ?? As it turns out, Octal AND Hexadecimal (base 16) are often used because they allow for easy conversion to and from binary. Why is Octal easy ?? Since Octal consists ONLY of the digits 0 through 7, ANY octal digit can be represented using only 3 bits: Octal 0 Binary OctalBinary

Page 3 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Why is that easy? Consider the binary number (which is and see the previous example) = (Check against Table) Notice that there is a direct transference from binary to octal and octal to binary.

Page 4 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Example 2: Consider the number Stop and Collect = In Octal ?? = Sure?? = 7 * * * 8080 = 7 * * * 1 = = 457

Page 5 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types What about Hexadecimal (Base 16) ?? Basically, Hex is used for the same reason: It is easy to convert Since 2 4 = 16 pieces of information, we can represent all the digits between 0 and 15: Digit Binary Digit Binary

Page 6 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types But 10, 11, 12, 13, 14, and 15 are NOT digits. They are Combinations of digits. True. We need to substitute the symbols: A = 10 B = 11 C = 12 D = 13 E = 14 F = 15 The Conversion Table Should be: Digit Binary Digit Binary A B C D E F1111

Page 7 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Once again, consider the binary number = = see the prior example What is the Hexadecimal Value ?? C Sure??? 5C 16 = 5 * C * 16 0 = 5C 16 = 5 * * 16 0 = 5 * * 1 = = 92

Page 8 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Example 2: Consider the number Stop and Collect = In Hexadecimal ?? E = 1E6 16 Sure?? 1E6 16 = 1 * E * * 16 0 = 1 * * * 16 0 = = 486 = 1 * * * 1

Page 9 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types What about Converting from Octal to Hexadecimal?? The easiest way is to use binary numbers: 57 8 = F= 2F 16 Sure??? = = = Octal 57 Hexadecimal = F 2 2F

Page 10 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft  Repeat Slides for this SectionRepeat Slides for this Section  Go To Next Set of Slides For this ChapterGo To Next Set of Slides For this Chapter  Go To Slide Index For Chapter 2Go To Slide Index For Chapter 2  Go To Slide Index For Chapter 3Go To Slide Index For Chapter 3  Go To Slide Index For TextbookGo To Slide Index For Textbook  Go To Home PageGo To Home Page This Concludes The Slides for this Section Choose an Option: