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.

Slides:



Advertisements
Similar presentations
Ch 4 Sec 2: Slide #1 Columbus State Community College Chapter 4 Section 2 Writing Fractions in Lowest Terms.
Advertisements

CONCEPTUAL ARITHMETIC METHODS WITH DECIMALS Division.
Divisibility Rules Page 10 in textbook.
Number Systems. 2 The total number of allowable symbols in a number system is called the radix or base of the system. Decimal Numbers: radix = 10 (symbols:
Chapter Chapter Goals Know the different types of numbers Describe positional notation.
1 Sequences and Mathematical Induction An important task of mathematics is to discover and characterize regular patterns, such as those associated with.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Chapter 02 Binary Values and Number Systems Nell Dale & John Lewis.
Exponents and Polynomials
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.
Math in Our World Section 4.3 Base Number Systems.
Rational Numbers and Decimals
1 Survey of Computer Science CSCI 110, Spring 2011 Lecture 16 Digital Circuits, binary Numbers.
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.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
Number Systems Binary and Hexadecimal. Base 2 a.k.a. Binary  Binary works off of base of 2 instead of a base 10 like what we are taught in school 
Data Representation – Binary Numbers
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.
Signed Numbers, Powers, & Roots
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Chapter 2 Basic Data Types.
CHAPTER OUTLINE 3 Decimals Slide 1 Copyright (c) The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3.1Decimal Notation and.
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!
1 Problem Solving using computers Data.. Representation & storage Representation of Numeric data The Binary System.
Math 409/409G History of Mathematics Babylonian Numbering System.
Integer Conversion Between Decimal and Binary Bases Conversion of decimal to binary more complicated Task accomplished by –Repeated division of decimal.
Engineering 1040: Mechanisms & Electric Circuits Spring 2014 Number Systems.
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,
When dividing a decimal by a whole number, place the decimal point in the quotient directly above the decimal point in the dividend. Then divide as you.
L4-3 Notes: Dividing Decimals by Whole Numbers
Integer Representation for People Computer Organization and Assembly Language: Module 3.
Section 3 Dividing Polynomials
Number systems, Operations, and Codes
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
Section 2.6 Representation of numbers. Decimal representation (base 10) Given a positive integer X, the decimal representation of X is a string of digits.
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.
Section 4.3 Other Bases.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft RAM Allocation Chapter 3.
Chapter 2 Number Systems Consists of a set of symbols called digits and a set of relations such as +, -, x, /.
Dividing Decimals Module 5 Lesson 4 GET READY TO WRITE NOTES.
Introduction To Number Systems Binary System M. AL-Towaileb1.
Copyright © 2015, 2008, 2011 Pearson Education, Inc. Section 6.3, Slide 1 Chapter 6 Polynomial Functions.
Page 1 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Strings Chapter 5.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
The Real Zeros of a Polynomial Function Section 5.2 Also Includes Section R.6 : Synthetic Division 1.
©2010 Cengage Learning SLIDES FOR CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION Click the mouse to move to the next page. Use the ESC key to exit.
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.
Products and Factors of Polynomials (part 2 of 2) Section 440 beginning on page 442.
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
Digital logic COMP214  Lecture 2 Dr. Sarah M.Eljack Chapter 1 1.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Unit 1 Introduction Number Systems and Conversion.
Warm up – August 14, 2017 How many significant digits are in the following numbers and what are they? Number Sig fig Which ones
Rational Numbers and Decimals
5 Rational Numbers: Positive and Negative Decimals.
COMPUTING FUNDAMENTALS
Convert Decimal to Binary
Chapter R Prealgebra Review Decimal Notation.
Number Systems and Binary Arithmetic
5.5 Dividing Signed Decimal Numbers
Numbering System TODAY AND TOMORROW 11th Edition
Dividing Decimals.
Digital Electronics and Microprocessors
Chapter 2: Number Systems
Synthetic Division.
Converting to Base-n from Base-10
Algebra 1 Section 9.6.
Information Representation
Introduction To Number Systems
Section 4.3 Other Bases.
Presentation transcript:

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 of ‘on’ and ‘off’ positions for a given number of light switches: With 3-bits, there are 8 possible combinations : And, with 4-bits, there are 16 possible combinations: Decimal To Binary

Page 2 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types The same sequencing pattern is used to represent numeric values DecimalBinary DecimalBinaryDecimalBinary

Page 3 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Is there any way of converting from decimal to binary?? Yes - The procedure is similar to one which we use all the time. Suppose you were asked to convert 5,752 seconds to Hours, Minutes, and Seconds. How would you do it???? Because there are 60 seconds to each minute: Because there are 60 minutes to each hour: Minutes Total Seconds 1 1 Hour Total Minutes So 5,752 Seconds = 1 hour, 35 minutes, and 52 seconds

Page 4 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Check: * 60 Seconds 5,700 Seconds + 52 Seconds 95 Minutes 5,752 Seconds 1 Hour * 60 = 60 MinutesNumber Hours Number Minutes Total Minutes Secs. Per Minute Number Seconds Total Seconds 35 Minutes Example #2: Convert 575 Inches to Yards, Feet, and Inches.

Page 5 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Because there 12 Inches in a Foot: 47 Total Feet No. Inches Because there 3 Feet in a Yard: 15 No. Yards No. Feet And so there are 15 yards, 2 feet, and 11 inches in 575 inches. Check: 3 * 15 = * 12 = = 575 Inches

Page 6 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types What does this have to do with converting from decimal to binary?? for hours to minutes or minutes to seconds OR by 12 for inches to feet OR by 3 for feet to yards We divide by 2 for decimal to binary AND keep track of the remainders. Reconstructing the number from LAST to FIRST Instead of dividing by 60

Page 7 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Take, for example, the number (which we know is ) FIRST, Divide 11 by 2: NEXT, Let the quotient become the new Dividend CONTINUE Until the Quotient is Zero (0) FINALLY, Collect the remainders from Last to First = 11 (Check the Table)

Page 8 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types 2 28 (The notation used varies slightly to save space) Quotient Remainder (If Even = 0; If Odd = 1) The New Quotient is Zero: Quit Collecting Remainders from last to first: The Binary Value is: Example 2: Convert to binary (= ):

Page 9 Data Structures in C for Non-Computer Science Majors Kirs and Pflughoeft Basic Data Types Example 3: Convert to binary: 44/2 = 22 The notation used differs to correspond to c syntax: / Integer Division: The result is the quotient % Modulus Arithmetic: The Result is the Remainder 44 % 2 = 0 22/2 = 1122 % 2 = 0 11/2 = 511 % 2 = 1 5/2 = 2 5 % 2 = 1 2/2 = 1 2 % 2 = 0 1/2 = 0 1 % 2 = 1 Since the New Quotient is 0: STOP Collecting from Last to First:

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: