COMPSCI 210. Binary Fractions. Agenda & Reading



Similar documents
CSI 333 Lecture 1 Number Systems

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

Useful Number Systems

Base Conversion written by Cathy Saxton

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

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

Lecture 11: Number Systems

Systems I: Computer Organization and Architecture

Recall the process used for adding decimal numbers. 1. Place the numbers to be added in vertical format, aligning the decimal points.

Solution Guide Chapter 14 Mixing Fractions, Decimals, and Percents Together

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

3. Convert a number from one number system to another

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

NUMBER SYSTEMS. 1.1 Introduction

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

Computer Science 281 Binary and Hexadecimal Review

PREPARATION FOR MATH TESTING at CityLab Academy

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

THE BINARY NUMBER SYSTEM

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

Paramedic Program Pre-Admission Mathematics Test Study Guide

Binary Numbers. Binary Octal Hexadecimal

Lecture 8: Binary Multiplication & Division

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

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

CPEN Digital Logic Design Binary Systems

=

NUMBER SYSTEMS. William Stallings

CS201: Architecture and Assembly Language

Number Representation

3 cups ¾ ½ ¼ 2 cups ¾ ½ ¼. 1 cup ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼. 1 cup. 1 cup ¾ ½ ¼ ¾ ½ ¼

Number Systems and Radix Conversion

Lecture 2. Binary and Hexadecimal Numbers

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

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Addition Methods. Methods Jottings Expanded Compact Examples = 15

Positional Numbering System

Chapter 2. Binary Values and Number Systems

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

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

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

Pre-Algebra Lecture 6

MATH-0910 Review Concepts (Haugen)

Decimal to Binary Conversion

Binary, Hexadecimal, Octal, and BCD Numbers

Numbering Systems. InThisAppendix...

CS321. Introduction to Numerical Methods

MEP Y9 Practice Book A

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

Dr Brian Beaudrie pg. 1

ADDITION. Children should extend the carrying method to numbers with at least four digits.

How do you compare numbers? On a number line, larger numbers are to the right and smaller numbers are to the left.

Accuplacer Arithmetic Study Guide

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

Review of Scientific Notation and Significant Figures

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

JobTestPrep's Numeracy Review Decimals & Percentages

Math Review. Numbers. Place Value. Rounding Whole Numbers. Place value thousands hundreds tens ones

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

one thousand, four AND six tenths three AND forty-two thousandths sixty-three ten-thousands Two hundred AND two hundreds 200.

Fractions to decimals

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

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

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

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

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

Chapter 4: Computer Codes

Decimals Adding and Subtracting

Sequential Skills. Strands and Major Topics

Number of bits needed to address hosts 8

HFCC Math Lab Arithmetic - 4. Addition, Subtraction, Multiplication and Division of Mixed Numbers

Chapter 1: Digital Systems and Binary Numbers

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

Integers, I, is a set of numbers that include positive and negative numbers and zero.

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

AN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k Design Consultant

Decimals and other fractions

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

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Maths Workshop for Parents 2. Fractions and Algebra

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

IP Subnetting and Related Topics A Tutorial by Chris Uriarte <chrisjur@cju.com> Updated April 2001

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

Linear Equations and Inequalities

Teaching Pre-Algebra in PowerPoint

Number and codes in digital systems

Chapter 1: Order of Operations, Fractions & Percents

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

Grade 6 Math Circles. Binary and Beyond

A Step towards an Easy Interconversion of Various Number Systems

Introduction to Decimals

Binary Adders: Half Adders and Full Adders

26 Integers: Multiplication, Division, and Order

The Answer to the 14 Most Frequently Asked Modbus Questions

Section 1.4 Place Value Systems of Numeration in Other Bases

Math Workshop October 2010 Fractions and Repeating Decimals

Preliminary Mathematics

Accentuate the Negative: Homework Examples from ACE

COMBINATIONAL CIRCUITS

Training Manual. Pre-Employment Math. Version 1.1

Transcription:

COMPSCI 21 Binary Fractions Agenda & Reading Topics: Fractions Binary Octal Hexadecimal Binary -> Octal, Hex Octal -> Binary, Hex Decimal -> Octal, Hex Hex -> Binary, Octal Animation: BinFrac.htm Example Code: Frac2Bin.html Exercise: Exercise 6-7 I-3 2 Fractions Decimal A decimal fraction is a fraction where the denominator is a power of ten. But are commonly expressed without a denominator, e.g., 8/1, 833/1, 83/1, and 8/1 are expressed as:.8, 8.33,.83, and.8 8.33 = 8 x 1 () + 3 x 1 (-1) + 3 x 1 (-2).195 = 1 x 1 (-1) + 9 x 1 (-2) + 5 x 1 (-3) Binary Proceeds in exactly the same way as decimal fractions power of 2.112 = 1 x 2 (-1) + 1 x 2 (-2) =.751 1.2 = 1 x 2 () + 1 x 2 (-1) + x 2 (-2) + 1 x 2 (-3) = 1.6251 Shockwave Movie: BinFrac.htm Converting Binary to Decimal Method 1: Successively multiply the fraction by the outgoing base (e.g. decimal = ). At each stage take the integral part as the digit and retain the fraction for the next stage. BinFrac.htm Example:.2.2 * = 11.1 (Integral part =3).12 * = 1.1 (Integral part =1).12 * = 1.1 (Integral part =2).12 * =. (Integral part =5) =.3125 Method 2: Working from the least significant fractional digit, append the digit as an integer prefix to the fraction-so-far and divide the whole by the incoming base (e.g. decimal=2) Example:.2 (fraction-so-far=) Take bit 1, f-s-f = ( + 1)/2 =.5 Take bit, f-s-f = (.5 + )/2 =.25 Take bit 1, f-s-f = (.25 + 1)/2 =.625 I-3 3 I-3 4

Shockwave Movie: BinFrac.htm Octal & Hexadecimal Fractions Octal power of 8.118 = 1 x 8 (-1) + 1 x 8 (-2) =.1251 +.156251 Converting Decimal to Binary Take the fraction part multiply by 2, and convert the integral part to get the value Example:.251 Take.25 * 2 =.5 (Integral part = ) =.146251 Weights 8 (2) 8 (1) 8 () 8 (-1) 8 (-2) Take.5 * 2 = 1. (Integral part = 1) Weight 64 8 1.125.15625 Value =.12 Hexadecimal Exercise:.6251 However, There are some fractions we can t represent..31 power of 16 Take.3 * 2 =.6 (Integral part = ).116 = 1 x 16 (-1) =.6251 Weights 16 (2) 16 (1) 16 () 16 (-1) Take.6 * 2 = 1.2 (Integral part = 1) Weight Value 256 16 1.625 Take.2 * 2 =.4 (Integral part = ) Examples Take.4 * 2 =.8 (Integral part = ).12 =.51 =.48 =.816 Take.8 * 2 = 1.6 (Integral part = 1).112 = 1 x 2 (-1) + 1 x 2 (-2) =.751 Take.6 * 2 = 1.2 (Integral part = 1) =.68 = 6 x 8 (-1) =. =.C16 = 12 x 16 (-1) Repeated I-3 5 I-3 6 Converting Binary to Octal Break the binary digits into groups of THREE starting from the binary point and convert each group into its appropriate octal digit Whole numbers it may be necessary to add a zero as the Most Significant Bit in order to complete a grouping of three bits. Fractions, it may be necessary to add a trailing zero in the Least Significant Bit in order to form a complete grouping of three. Example:.2.1 1 =.248 Converting Binary to Hexadecimal Break the binary digits into groups of FOUR starting from the binary point and convert each group into its appropriate hex digit. Again, it may be necessary to add leading/trailing zeros Example:.12. 1 =.5416 Converting Octal to Binary Replace the octal digit with the corresponding binary pattern Example:.1428 =.1 1 12 Exercise: 15.1238 Converting Octal to Hexadecimal Replace the octal digit with the corresponding binary pattern, regroup digits in a group of 4 and replace with the corresponding hex digit Example: 2.478 = 1.1 1112 = 1. 11 = 2.9C16 Exercise: 12.38 I-3 7 I-3 8

Example: Frac2Bin.html (Enter a decimal fraction (. <= value < 1.), select the base Converting Decimal to Octal Take the fraction part multiply by 8, and convert the integral part to get the value Example:.31251 Take.3125 * 8 = 2.5 (Integral part = 2) Take.5 * 8 = 4. (Integral part = 4) =.248 Exercise:.6251 Converting Decimal to Hexadecimal Take the fraction part multiply by 16, and convert the integral part to get the value Example:.6251 Take.625 * 16 = 1. (Integral part = 1) =.a16 Converting Hexadecimal to Binary Replace the hex digit with the corresponding binary pattern Example: 2.A716 = 1. 1112 Exercise: 1.F316 Converting Hexadecimal to Octal Replace the hex digit with the corresponding binary pattern, regroup digits in a group of 3 and replace with the corresponding octal digit Example: 2.A716 = 1. 1112 = 1. 1 11 = 2.5168 Exercise : 1.F316 I-3 9 I-3 1 Exercises: Convert 1.11 from Binary Fraction to Decimal Fraction Exercises: Convert octal fraction 15.123 to Binary fraction Convert.625 from decimal Fraction to Binary Fraction Convert octal fraction 12.3 to Hexadecimal fraction I-3 11 I-3 12

Exercises: Convert Hexadecimal fraction 1.F3 to Binary fraction Convert Hexadecimal fraction 1.F3 to Octal Binary Fractions Addition & Subtraction add/subtract fractions using simple Math (align the radix point). Example:. +.1 +.1.111 Example:. -.1. -.1.1 Since we re just doing natural arithmetic, the carry flag has the same meaning. +.1 1.1 I-3 13 I-3 14 Exercises 1. + 1.111 1. 11.11 Binary Fractions - Multiplication Steps: Ignore the radix point -- do not align them -- and multiply the numbers as whole numbers. Then, starting from the right of the product, separate as many places as there are in the two numbers together. Example: 1.1 * 1.1 * Now we must put back the radix point. Together, 1.1 and 1.1 have four binary places. Therefore, starting from the right, separate four places: 1.1 I-3 15 I-3 16

Example:. (A) (5.625 in decimal) 11.1 (B) (6.25 in decimal) ----------------- Corresponds to a one in B + Corresponds to a zero in B + + + ----------------------- =111. (35.15625 in decimal) Binary Fractions - Division Steps: The divisor must be a whole number. If it is not, then we will multiply (or shifting) it so that it becomes one. And Multiply (shifting) the dividend by the same power Example: 1.1 / 1.1 => 1.1 / Answer = 1.1 1.1 1.1 1 1 I-3 17 I-3 18 Exercises 1. * 11.11 1. / 11.11 I-3 19