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

Slides:



Advertisements
Similar presentations
Lecture - 2 Number systems and computer data formats
Advertisements

Chapter 8 Representing Information Digitally.
Lecturer: Omid Jafarinezhad Sharif University of Technology Department of Computer Engineering 1 Fundamental of Programming (C) Lecture 2 Number Systems.
©1999 Addison Wesley Longman2.1 A Bit About Bits A bit (binary digit) –is the smallest unit of information –can have two values - 1 and 0. Binary digits,
CMPUT Computer Organization and Architecture I
Chapter 2 : Number System
Introduction to Computer Systems and Software Lecture 2 of 2 Simon Coupland
J. Michael Moore Computer Organization CSCE 110. J. Michael Moore High Level View Of A Computer ProcessorInputOutput Memory Storage.
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
Data Representation (in computer system) Computer Fundamental CIM2460 Bavy LI.
Computer Systems Nat 4/5 Computing Science Data Representation Lesson 3: Storing Text.
CODING SYSTEMS CODING SYSTEMS CODING SYSTEMS. CHARACTERS CHARACTERS digits: 0 – 9 (numeric characters) letters: alphabetic characters punctuation marks:
Simple Data Type Representation and conversion of numbers
Cosc175/data1 Data comprised of constants and variables information stored in memory Each memory location has an address Address - number identifying a.
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?
CSCI 125 & 161 Lecture 2 Martin van Bommel. Hardware vs Software Hardware - physical components you can see and touch –e.g. processor, keyboard, disk.
Computer System Basics 1 Number Systems & Text Representation Computer Forensics BACS 371.
Computers Organization & Assembly Language
1 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
IT253: Computer Organization
Fundamental of Computer Architecture By Panyayot Chaikan November 01, 2003.
Binary Arithmetic & Data representation
Data Representation.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
COMPSCI 210 Semester Tutorial 1
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Computer Systems Architecture Copyright © Genetic Computer School 2008 CSA 1- 0 Lesson 1 Number System.
The Teacher CP4 Binary and all that… CP4 Revision.
1 Lecture 2  Complement  Floating Point Number  Character Encoding.
The Hexadecimal Number System and Memory Addressing ISAT 121.
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.
The Teacher CP4 Binary and all that… CP4 Revision.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Data as the computer sees it 1.  Number systems Number systems  Data storage Data storage  Glossary Glossary 2.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Data Representation.
Floating Point Binary A2 Computing OCR Module 2509.
CS 160 Lecture 4 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.
Software Design and Development Storing Data Computing Science.
Floating Point Numbers
Nat 4/5 Computing Science Data Representation Lesson 3: Storing Text
CS2100 Computer Organisation
Nat 4/5 Computing Science Data Representation Lesson 3: Storing Text
Lec 3: Data Representation
CS2100 Computer Organisation
Number Representation
Data Representation Binary Numbers Binary Addition
CSCI 198: Lecture 4: Data Representation
CSCI 161: Lecture 4: Data Representation
EPSII 59:006 Spring 2004.
CS1010 Programming Methodology
By: Briley Cooper, David Chaney, Josh Martin, and Mason Branscum
COMS 161 Introduction to Computing
Storing Negative Integers
Computer Organization
Numbers representations
Storing Integers and Fractions
COMS 161 Introduction to Computing
Presentation transcript:

CS 125 Lecture 3 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

Character Representation 1 byte = 8 bits = 1 character? 256 possible codes with 8 bits Assign a character to each code Two common assignments –ASCII - American Standard Code for Information Interchanger –EBCDIC - Extended Binary Coded Decimal Interchange Code

ASCII Code Code ValueLetter 0Null character Special Characters 10\n = New line 32Space 33-47, 58-64, 91-96Punctuation A - Z a - z

16 bits? Two characters? One integer? Part of a floating point? Machine language instruction? Memory address? Depends on application!