CS 160 Lecture 4 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add 0111111111111111 + 0000000000000001 1000000000000000 =

Slides:



Advertisements
Similar presentations
COMP2130 Winter 2015 Storing signed numbers in memory.
Advertisements

Introduction to Computer Systems and Software Lecture 2 of 2 Simon Coupland
Binary & Decimal numbers = 3* * *10 + 5*1 = 3* * * *10 0 Decimal system: Ten digits: 0,1,2,3,…,9 Example:
J. Michael Moore Computer Organization CSCE 110. J. Michael Moore High Level View Of A Computer ProcessorInputOutput Memory Storage.
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
Computer Science 210 Computer Organization Floating Point Representation.
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
Number systems Converting numbers between binary, octal, decimal, hexadecimal (the easy way)
ES 84 Numerical Methods for Engineers, Mindanao State University- Iligan Institute of Technology Prof. Gevelyn B. Itao.
Simple Data Type Representation and conversion of numbers
Numbers and number systems
Binary Representation. Binary Representation for Numbers Assume 4-bit numbers 5 as an integer  as an integer  How? 5.0 as a real number  How?
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
IT253: Computer Organization
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: October 22, 2004 Lecture Number: 24.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
The Teacher CP4 Binary and all that… CP4 Revision.
1 Lecture 2  Complement  Floating Point Number  Character Encoding.
Positional Number Systems
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
ITEC 1011 Introduction to Information Technologies 4. Floating Point Numbers Chapt. 5.
The Teacher CP4 Binary and all that… CP4 Revision.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)
Copyright © Curt Hill Numerics Representation and Errors.
Binary01.ppt Decimal Decimal: Base 10 means 10 Unique numerical digits ,00010,000 Weight Positions 3,
Floating Point in Binary 1.Place Value Chart:
Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems
Extending Binary In today’s lesson we will look at: representing different types of numbers possible errors binary coded decimal (BCD) comparing BCD with.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
Floating Point Binary A2 Computing OCR Module 2509.
Numbers in Computers.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
Cis303a_chapt03_exam1_answer.ppt CIS303A: System Architecture Exam 1: Chapter 3 Answer List the characters (digits) for the following bases. 1) Decimal:
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
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.
Learning Objectives 3.3.1f - Describe the nature and uses of floating point form 3.3.1h - Convert a real number to floating point form Learn how to normalise.
DATA REPRESENTATION Data Types Complements Fixed Point Representations
Software Design and Development Storing Data Computing Science.
FLOATING-POINT NUMBER REPRESENTATION
Floating Point Numbers
Nat 4/5 Computing Science Lesson 1: Binary
Fundamentals of Computer Science
Data Representation Covering… Binary addition / subtraction
Objectives Today: P4 Data Types – Floating Points P4 Variable Quiz P3 Iteration and Selection Practical Are you logged on? Then come around the table Unit.
Binary & Decimal numbers
Number Systems and Binary Arithmetic
CSCI 198: Lecture 4: Data Representation
CSCI 161: Lecture 4: Data Representation
ECE 103 Engineering Programming Chapter 3 Numbers
A Level Computing Component 2
CS1010 Programming Methodology
Binary Quiz UIN: ____________________
By: Briley Cooper, David Chaney, Josh Martin, and Mason Branscum
BCD = Binary Coded Decimal
Computer Organization
Numbers representations
Storing Integers and Fractions
Hexadecimal.
COMS 161 Introduction to Computing
Data Binary Arithmetic.
Number systems Converting numbers between binary, octal, decimal, hexadecimal (the easy way)
39 32 Exponent Sign 31 Mantissa 30 Operations are perfomred with an implied binary point between bits 31 and 30. When the implied most significant.
Presentation transcript:

CS 160 Lecture 4 Martin van Bommel

Overflow In 16-bit two’s complement, what happens if we add = -32,768 So how do we store numbers > 32,767?

Large and Small Numbers On 9-digit calculator, = 1.0 E 9 In binary, = 1.0 x 2^8 Small numbers, = = 1.0 x 2^(-1)

Real Numbers in Binary x 2^4 = = = 13.5 In 16-bit word, sign mantissa exponent

8-bit Floating Point Binary? SMMMSXXX S-sign M-mantissa X-exp Largest number = x 2^111 = x 2^7 = 111 x 2^4 = 7 x 16 = 112 Larger? Use more bits, but still limit

8-bit Floating Point Addition = 1010 = x 2^4 = x 2^0100 => = 0001 = x 2^1 = x 2^0001 => add - align bits ( ) x 2^ x 2^100 => round-off error - add more bits, but limited

Precision and Overflow Precision - number of significant digits Single precision floating point (32-bits) has 24-bit mantissa = 6-7 decimal digits If too precise, digits lost = Overflow - number too big or too small Fatal error - invalid result (32, = -1)

Octal and Hexadecimal Octal - Base 8 - digits 0, 1, 2, 3, 4, 5, 6, 7 Hex - Base 16 - digits 0 - 9, A, B, C, D, E, F easy to convert from binary, = = 9D1 16