The Mathematics Driving License for Computer Science- CS10410

Similar documents
Lecture 11: Number Systems

Base Conversion written by Cathy Saxton

Useful Number Systems

Computer Science 281 Binary and Hexadecimal Review

Solution for Homework 2

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Number Representation

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

CSI 333 Lecture 1 Number Systems

Section 1.4 Place Value Systems of Numeration in Other Bases

Chapter 2. Binary Values and Number Systems

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

Binary Representation

Binary Numbers. Binary Octal Hexadecimal

NUMBER SYSTEMS. William Stallings

COMPSCI 210. Binary Fractions. Agenda & Reading

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

CPEN Digital Logic Design Binary Systems

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Binary Adders: Half Adders and Full Adders

The string of digits in the binary number system represents the quantity

Chapter 1: Digital Systems and Binary Numbers

Number Systems and Radix Conversion

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Lecture 2. Binary and Hexadecimal Numbers

NUMBER SYSTEMS. 1.1 Introduction

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

2011, The McGraw-Hill Companies, Inc. Chapter 3

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Chapter 4: Computer Codes

3. Convert a number from one number system to another

THE BINARY NUMBER SYSTEM

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

=

Numbering Systems. InThisAppendix...

CS321. Introduction to Numerical Methods

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Binary, Hexadecimal, Octal, and BCD Numbers

A Short Guide to Significant Figures

Positional Numbering System

Figure 1. A typical Laboratory Thermometer graduated in C.

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Addition Methods. Methods Jottings Expanded Compact Examples = 15

Systems I: Computer Organization and Architecture

CS201: Architecture and Assembly Language

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

CHAPTER 5 Round-off errors

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Subnetting Examples. There are three types of subnetting examples I will show in this document:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Fractions to decimals

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

BINARY CODED DECIMAL: B.C.D.

NUMBER SYSTEMS TUTORIAL

A Step towards an Easy Interconversion of Various Number Systems

Decimal to Binary Conversion

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Everything you wanted to know about using Hexadecimal and Octal Numbers in Visual Basic 6

Goals. Unary Numbers. Decimal Numbers. 3,148 is s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Chapter 1. Binary, octal and hexadecimal numbers

Classless Subnetting Explained

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

Chapter 5. Binary, octal and hexadecimal numbers

JobTestPrep's Numeracy Review Decimals & Percentages

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

2.3 IPv4 Address Subnetting Part 2

HOMEWORK # 2 SOLUTIO

Radicals - Multiply and Divide Radicals

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

2.6 Exponents and Order of Operations

Activity 6.7.4: IPv4 Address Subnetting Part 2

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Numerator Denominator

0.8 Rational Expressions and Equations

Chapter 4 -- Decimals

Number and codes in digital systems

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Session 29 Scientific Notation and Laws of Exponents. If you have ever taken a Chemistry class, you may have encountered the following numbers:

Florida Math Correlation of the ALEKS course Florida Math 0018 to the Florida Mathematics Competencies - Lower

Exponents, Radicals, and Scientific Notation

Basic numerical skills: FRACTIONS, DECIMALS, PROPORTIONS, RATIOS AND PERCENTAGES

PREPARATION FOR MATH TESTING at CityLab Academy

Supplemental Worksheet Problems To Accompany: The Pre-Algebra Tutor: Volume 1 Section 1 Real Numbers

Review of Scientific Notation and Significant Figures

3.1. RATIONAL EXPRESSIONS

Lecture 4: Binary. CS442: Great Insights in Computer Science Michael L. Littman, Spring I-Before-E, Continued

Lies My Calculator and Computer Told Me

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

YOU MUST BE ABLE TO DO THE FOLLOWING PROBLEMS WITHOUT A CALCULATOR!

5.1 Radical Notation and Rational Exponents

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix:

Transcription:

The Mathematics Driving License for Computer Science- CS10410 Approximating Numbers, Number Systems and 2 s Complement by Nitin Naik

Approximating Numbers There are two kinds of numbers: Exact Number and Approximate Number. Exact Numbers arise from counting. Approximate Numbers arise from measurement or calculation. We can never perform a completely accurate measurement with a ruler, tape measure or thermometer. There is always some inaccuracy involved.

Approximating Numbers.. Sometimes instead of giving exact numbers, it is preferable to give approximations. This is especially when if we want to be vague about the numbers we are reporting! Certain numbers simply cannot be written exactly in decimal form. Many fractions and all irrational numbers fall into this category. For example the fraction 1/3 is approximately but not exactly equal to 0.333 and the irrational number 3 is approximately but not exactly equal to 1.73.

Examples

Significant Digits or Figures All the digits in the number are significant digits (also known as significant figures) except if the digit is a zero that is used just to locate the decimal point then it is not significant. This means a digit which is 0 is significant if it is not a place holder. In an approximate number the leftmost digit is said to be the Most Significant Digit and the rightmost digit is the Least Significant Digit. Significant digits give an indication of the accuracy of a number.

Significant Digits or Figures.. Example-1: The approximate number is 5.619 It has 4 significant digits. The digit 5 is the Most Significant Digit (MSD). The digit 9 is the Least Significant Digit (LSD).

Significant Digits or Figures..

Accuracy and Precision Accuracy The accuracy of an approximate number is given by the number of significant digits in it. Precision The precision of an approximate number is given by the position of the rightmost significant digit (decimal position of the last significant digit).

Example Comparing the two numbers 0.051 and 4.673 Accuracy Here 4.673 is more accurate because it has four significant digits, where 0.051 only has two. Precision The two numbers have the same precision, as the last significant digit is in the thousandths position for both.

Rounding Numbers When rounding number to a certain place value then all digits to the right of that place are dropped.

Rounding Down If the first dropped digit in number is 0, 1, 2, 3, or 4 then the least significant digit kept is not changed. This is called rounding down.

Rounding Up If the first dropped digit in number is 5, 6, 7, 8 or 9 then the least significant digit kept is increased by 1. This is called rounding up.

Rounding Examples Example-1: 70.531 The number 70.531 rounded to four significant digits is 70.53 The number 70.531 rounded to three significant digits is 70.5 The number 70.531 rounded to two significant digits is 71

Rounding Examples.. Example-2:Some examples of rounding to 2 decimal places (the dropped digits are shown in red):

Rounding Examples.. Example-3:Some examples of rounding to 3 significant figures (the dropped digits are shown in red):

Operations with Approximate Numbers When adding or subtracting approximate numbers, the result should have the precision of the least precise number. Example-1: When adding 2.3, 5.704 and 12.67, our final answer should be correct to one decimal place. 2.3 + 5.704 + 12.67 = 20.674 20.7 (the symbol for "is approximately equal to")

Operations with Approximate Numbers.. When multiplying or dividing approximate numbers, the result should have the accuracy of the least accurate number. Example-2: When multiplying 3.564 and 2.37, our final answer should have three significant digits. 3.564 2.37 = 8.44668 8.45

Operations with Approximate Numbers.. When finding the square root of a number, the result has the same accuracy as the number. Example-3: 22.97 should be written correct to 4 significant digits: 22.97 4.793 (same accuracy)

Number System It is the set of characters and mathematical rules that are used to represent a number.

Decimal Number System The Decimal number system consists of ten digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 and afterwards the numbers are formed by grouping these digits together and known as Base-10 system.

Decimal Number System..

Binary Number System The Binary number system is similar to the decimal system except binary system contains only two digits- 0 and 1 and called Base-2 system.

Octal Number System The Octal number system consists of eight digits 0, 1, 2, 3, 4, 5, 6, and 7 and called Base-8 system. Octal was used extensively in early mainframe computer systems, but has become less popular in favor of binary and hexadecimal today.

Hexadecimal Number System The Hexadecimal number system uses 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F and thus called Base-16 system. Hexadecimal numbers are easy to convert to the computer's internal binary code and are more compact than binary numbers.

Hexadecimal Number System.. Decimal Values of Hex Alphabets

Number System Conversions Actually we commonly understand only Decimal number system so the number written in other three number systems must be converted to know the actual decimal value of that number. Number system conversions are also required for many computer applications and operations. Here we will study the most important number system conversions.

Binary to Decimal Conversion For this conversion remember these values: 2 0 =1 2 0 =1/1=1 2 1 =2 2-1 =1/2=0.5 2 2 =4 2-2 =1/4=0.25 2 3 =8 2-3 =1/8=0.125 2 4 =16 2-4 =1/16=0.0625 2 5 =32 2-5 =1/32=0.03125 2 6 =64 2-6 =1/64=0.015625 2 7 =128 2-7 =1/128=0.0078125 2 8 =256 2-8 =1/256=0.00390625 2 9 =512 2-9 =1/512=0.001953125 2 10 =1024 2-10 =1/1024=0.0009765625

Binary to Decimal Conversion (Integer Part)

Binary to Decimal Conversion (Integer Part)..

Binary to Decimal Conversion (Real Part)

Octal to Decimal Conversion For this conversion remember these values:

Octal to Decimal Conversion..

Hexadecimal to Decimal Conversion For this conversion remember these values:

Hexadecimal to Decimal Conversion..

Binary-to-Octal or Octal-to-Binary Three binary digits are equivalent to one octal digit, as shown in the table below:

Binary-to-Octal To convert from binary to octal, divide the binary number into groups of 3 digits starting on the right of the binary number. If the leftmost group has less than 3 bits, put in the necessary number of leading zeroes on the left. For each group of three bits, write the corresponding single octal digit.

Binary-to-Octal..

Binary-to-Octal..

Octal-to-Binary To convert from octal to binary, write the corresponding group of three binary digits for each octal digit.

Octal-to-Binary..

Binary-to-Hexadecimal or Hexadecimal-to-Binary Four binary digits are equivalent to one hexadecimal digit, as shown in the given table.

Binary-to-Hexadecimal To convert from binary to hexadecimal, divide the binary number into groups of 4 digits starting on the right of the binary number. If the leftmost group has less than 4 bits, put in the necessary number of leading zeroes on the left. For each group of four bits, write the corresponding single hex digit.

Binary-to-Hexadecimal..

Binary-to-Hexadecimal..

Hexadecimal-to-Binary To convert from hexadecimal to binary, write the corresponding group of four binary digits for each hex digit.

Hexadecimal-to-Binary..

Two's Complement Notation Property Two's complement number representation is used for signed numbers on most modern computers. Two's complement representation allows the use of binary arithmetic operations on signed integers, yielding the correct 2's complement results.

Two's Complement Notation.. Positive Numbers Positive 2's complement numbers are represented as the simple binary. Negative Numbers Negative 2's complement numbers are represented as the binary number that when added to a positive number of the same magnitude equals zero. Sign Bit The most significant bit is called the sign bit. Operations This notation allows a computer to add and subtract numbers using the same operations (thus we do not need to implement adders and subtractors).

One's Complement In one's complement, positive numbers are represented as usual in regular binary. However, negative numbers are represented differently. To negate a number, replace all zeros with ones, and ones with zeros - flip the bits. Example: 12 = 0 0 0 0 1 1 0 0 and -12 = 1 1 1 1 0 0 1 1 (1 s Complement) As in signed magnitude, the leftmost bit indicates the sign (1 is negative, 0 is positive). To compute the value of a negative number, flip the bits and translate as before.

Two's Complement Example: 12 = 0 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 (1 s Complement) + 1 --------------------------------- -12 = 1 1 1 1 0 1 0 0 (2 s Complement)

References www.gnosislearning.com/_document/approximating+ Numbers.pdf http://www.intmath.com/numbers/5-approximatenumbers.php http://mathonweb.com/help_ebook/html/numbers_8. htm http://www.thevbprogrammer.com/ch04/number%20 Systems%20Tutorial.pdf http://academic.evergreen.edu/projects/biophysics/te chnotes/program/2s_comp.htm http://www.math.grin.edu/~rebelsky/courses/152/97f /Readings/student-binary#one

Thank You