Chapter 2 Bits, Data Types, and Operations


 Stephen Tracy Casey
 3 years ago
 Views:
Transcription
1 Chapter Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize two conditions:. presence of a voltage we ll call this state. absence of a voltage we ll call this state Could base state on value of voltage, but control and detection circuits more complex. compare turning on a light switch to measuring or regulating voltage 
2 Computer is a binary digital system. Digital system: finite number of symbols Binary (base two) system: has two states: and Basic unit of information is the binary digit, or bit. Values with more than two states require multiple bits. A collection of two bits has four possible states:,,, A collection of three bits has eight possible states:,,,,,,, A collection of n bits has n possible states.  What kinds of data do we need to represent? Numbers signed, unsigned, integers, floating point, complex, rational, irrational, Text characters, strings, Images pixels, colors, shapes, Sound Logical true, false Instructions Data type: representation and operations within the computer We ll start with numbers 
3 Unsigned Integers Nonpositional notation could represent a number ( ) with a string of ones ( ) problems? Weighted positional notation like decimal numbers: 9 is worth, because of its position, while 9 is only worth 9 most significant 9 least significant x + x + 9x = 9 x + x + x =  Unsigned Integers (cont.) An nbit unsigned integer represents n values: from to n . 
4 Unsigned Binary Arithmetic Base addition just like base! add from right to left, propagating carry carry Subtraction, multiplication, division,  Signed Integers With n bits, we have n distinct values. assign about half to positive integers ( through n ) and about half to negative ( n through ) that leaves two values: one for, and one extra Positive integers just like unsigned zero in most significant (MS) bit = Negative integers signmagnitude set MS bit to show negative, other bits are the same as unsigned =  one s complement flip every bit to represent negative =  in either case, MS bit indicates sign: =positive, =negative 
5 Two s Complement Problems with signmagnitude and s complement two representations of zero (+ and ) arithmetic circuits are complex How to add two signmagnitude numbers? e.g., try + () How to add to one s complement numbers? e.g., try + () Two s complement representation developed to make circuits easy for arithmetic. for each positive number (X), assign value to its negative (X), such that X + (X) = with normal addition, ignoring carry out () (9) + () + (9) () () 9 Two s Complement Representation If number is positive or zero, normal binary representation, zeroes in upper bit(s) If number is negative, start with positive number flip every bit (i.e., take the one s complement) then add one () (9) ( s comp) ( s comp) + + () (9) 
6 Two s Complement Shortcut To take the two s complement of a number: copy bits from right to left until (and including) the first flip remaining bits to the left ( s comp) (flip) + (copy)  Two s Complement Signed Integers MS bit is sign bit it has weight n. Range of an nbit number:  n through n. The most negative number ( n ) has no positive counterpart
7 Converting Binary ( s C) to Decimal. If leading bit is one, take two s complement to get a positive number.. Add powers of that have in the corresponding bit positions.. If original number was negative, add a minus sign. X = two = + + = ++ = ten n 9 n Assuming bit s complement numbers.  More Examples X = two = = +++ = 9 ten X = two X = = + + = ++ = ten X =  ten n 9 n Assuming bit s complement numbers. 
8 Converting Decimal to Binary ( s C) First Method: Division. Find magnitude of decimal number. (Always positive.). Divide by two remainder is least significant bit.. Keep dividing by two until answer is zero, writing remainders from right to left.. Append a zero as the MS bit; if original number was negative, take two s complement. X = ten / = r bit / = r bit / = r bit / = r bit / = r bit / = r bit X = two / = r bit  Converting Decimal to Binary ( s C) Second Method: Subtract Powers of Two. Find magnitude of decimal number.. Subtract largest power of two less than or equal to number.. Put a one in the corresponding bit position.. Keep subtracting until result is zero.. Append a zero as MS bit; if original was negative, take two s complement. n 9 n X = ten  = bit  = bit  = bit X = two 
9 Operations: Arithmetic and Logical Recall: a data type includes representation and operations. We now have a good representation for signed integers, so let s look at some arithmetic operations: Addition Subtraction Sign Extension We ll also look at overflow conditions for addition. Multiplication, division, etc., can be built from these basic operations. Logical operations are also useful: AND OR NOT  Addition As we ve discussed, s comp. addition is just binary addition. assume all integers have the same number of bits ignore carry out for now, assume that sum fits in nbit s comp. representation () () + () + (9) (9) (9) Assuming bit s complement numbers.  9
10 Subtraction Negate subtrahend (nd no.) and add. assume all integers have the same number of bits ignore carry out for now, assume that difference fits in nbit s comp. representation () ()  ()  (9) () () + () + (9) () () Assuming bit s complement numbers. 9 Sign Extension To add two numbers, we must represent them with the same number of bits. If we just pad with zeroes on the left: bit bit () (still ) () (, not ) Instead, replicate the MS bit  the sign bit: bit bit () (still ) () (still ) 
11 Overflow If operands are too big, then sum cannot be represented as an nbit s comp number. () () + (9) + (9) () (+) We have overflow if: signs of both operands are the same, and sign of sum is different. Another test  easy for hardware: carry into MS bit does not equal carry out  Logical Operations Operations on logical TRUE or FALSE two states  takes one bit to represent: TRUE=, FALSE= A B A AND B A B A OR B A NOT A View nbit number as a collection of n logical values operation applied to each bit independently 
12 Examples of Logical Operations AND useful for clearing bits AND with zero = AND with one = no change AND OR useful for setting bits OR with zero = no change OR with one = OR NOT unary operation  one argument flips every bit NOT  Hexadecimal Notation It is often convenient to write binary (base) numbers as hexadecimal (base) numbers instead. fewer digits  four bits per hex digit less error prone  easy to corrupt long string of s and s Binary Hex Decimal Binary Hex Decimal 9 9 A B C D E F 
13 Converting from Binary to Hexadecimal Every four bits is a hex digit. start grouping from righthand side A F D This is not a new machine representation, just a convenient way to write the number.  Fractions: FixedPoint How can we represent fractions? Use a binary point to separate positive from negative powers of two  just like decimal point. s comp addition and subtraction still work. if binary points are aligned  =.  =.  =.. (.) +. (.). (9.) No new operations  same as integer arithmetic. 
14 Very Large and Very Small: FloatingPoint Large values:. x  requires 9 bits Small values:. x   requires > bits Use equivalent of scientific notation : F x E Need to represent F (fraction), E (exponent), and sign. IEEE FloatingPoint Standard (bits): b b b S Exponent Fraction N = (" ) N = (" ) S S!.fraction!!.fraction! exponent" ", # exponent #, exponent =  Floating Point Example Singleprecision IEEE floating point number: sign exponent fraction Sign is number is negative. Exponent field is = (decimal). Fraction is. =. (decimal). Value = . x () = . x  = .. 
15 FloatingPoint Operations Will regular s complement arithmetic work for Floating Point numbers? (Hint: In decimal, how do we compute. x + 9. x?) 9 Text: ASCII Characters ASCII: Maps characters to bit code. both printable and nonprintable (ESC, DEL, ) characters nul dle soh dc stx dc etx dc eot dc enq nak ack syn bel etb bs can 9 ht 9 em 9 a nl a sub a b vt b esc b c np c fs c d cr d gs d e so e rs e f si f us f sp! " # $ % & ' ( ) * +, . / 9 a b c d e f 9 : ; < = >? 9 a b c d e A B C D E F G H I J K L M N O 9 a b c d e f P Q R S T U V W X Y Z [ \ ] ^ _ 9 a b c d e f ` a b c d e f g h i j k l m n o 9 a b c d e f p q r s t u v w x y z { } ~ del 
16 Interesting Properties of ASCII Code What is relationship between a decimal digit ('', '', ) and its ASCII code? What is the difference between an uppercase letter ('A', 'B', ) and its lowercase equivalent ('a', 'b', )? Given two ASCII characters, how do we tell which comes first in alphabetical order? Are characters enough? ( No new operations  integer arithmetic and logic.  Other Data Types Text strings sequence of characters, terminated with NULL () typically, no hardware support Image array of pixels monochrome: one bit (/ = black/white) color: red, green, blue (RGB) components (e.g., bits each) other properties: transparency hardware support: typically none, in generalpurpose processors MMX  multiple bit operations on bit word Sound sequence of fixedpoint numbers 
17 LC Data Types Some data types are supported directly by the instruction set architecture. For LC, there is only one hardwaresupported data type: bit s complement signed integer Operations: ADD, AND, NOT Other data types are supported by interpreting bit values as logical, text, fixedpoint, etc., in the software that we write. 
Chapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified slides by Chris Wilcox, Colorado State University How do we represent data in a computer?!
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Original slides from Gregory Byrd, North Carolina State University Modified by Chris Wilcox, S. Rajopadhye Colorado State University How do we represent data
More informationChapter 2 Bits, Data Types, and Operations
Chapter 2 Bits, Data Types, and Operations Computer is a binary digital system. Digital system: finite number of symbols Binary (base two) system: has two states: 0 and 1 Basic unit of information is the
More informationCPS 104 Computer Organization and Programming Lecture2 : Data representations,
CPS 104 Computer Organization and Programming Lecture2 : Data representations, Sep. 1, 1999 Dietolf Ramm http://www.cs.duke.edu/~dr/cps104.html CPS104 Lec2.1 GK&DR Fall 1999 Data Representation Computers
More informationNumbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras
Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15
More informationFundamentals of Programming (C)
Borrowed from lecturer notes by Omid Jafarinezhad Fundamentals of Programming (C) Group 8 Lecturer: Vahid Khodabakhshi Lecture Number Systems Department of Computer Engineering Outline Numeral Systems
More informationNumber Systems Base r
King Fahd University of Petroleum & Minerals Computer Engineering Dept COE 2 Fundamentals of Computer Engineering Term 22 Dr. Ashraf S. Hasan Mahmoud Rm 2244 Ext. 724 Email: ashraf@ccse.kfupm.edu.sa 3/7/23
More informationData Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?
CSC 2400: Computer Systems Data Representa5on What kinds of data do we need to represent?  Numbers signed, unsigned, integers, floating point, complex, rational, irrational,  Text characters, strings,
More informationData Representa5on. CSC 2400: Computer Systems. What kinds of data do we need to represent?
CSC 2400: Computer Systems Data Representa5on What kinds of data do we need to represent?  Numbers signed, unsigned, integers, floating point, complex, rational, irrational,  Text characters, strings,
More informationData Representation and Binary Arithmetic. Lecture 2
Data Representation and Binary Arithmetic Lecture 2 Computer Data Data is stored as binary; 0 s and 1 s Because twostate ( 0 & 1 ) logic elements can be manufactured easily Bit: binary digit (smallest
More informationBits and Bytes. Data Representation. A binary digit or bit has a value of either 0 or 1; these are the values we can store in hardware devices.
Bits and Bytes 1 A binary digit or bit has a value of either 0 or 1; these are the values we can store in hardware devices. A byte is a sequence of 8 bits. A byte is also the fundamental unit of storage
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationCS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON
CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi TAs: Pradip Vallathol and Junaid Khalid Midterm Examination 1 In Class (50 minutes) Friday, September
More informationCS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON
CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi TAs: Junaid Khalid and Pradip Vallathol Midterm Examination 1 In Class (50 minutes) Friday, September
More informationUnder the Hood: Data Representation. Computer Science 104 Lecture 2
Under the Hood: Data Representation Computer Science 104 Lecture 2 Admin Piazza, Sakai Up Everyone should have access Homework 1 Posted Due Feb 6 PDF or Plain Text Only: No Word or RTF Recommended: Learn
More information1.1. INTRODUCTION 1.2. NUMBER SYSTEMS
Chapter 1. 1.1. INTRODUCTION Digital computers have brought about the information age that we live in today. Computers are important tools because they can locate and process enormous amounts of information
More informationDATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes
1 DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations Other Binary Codes Error Detection Codes 2 Data Types DATA REPRESENTATION Information that a Computer
More informationNumber Representations
Simple Arithmetic [Arithm Notes] Number representations Signed numbers Signmagnitude, ones and twos complement Arithmetic Addition, subtraction, negation, overflow MIPS instructions Logic operations MIPS
More informationNumber System (Different Ways To Say How Many) Fall 2016
Number System (Different Ways To Say How Many) Fall 2016 Introduction to Information and Communication Technologies CSD 102 Email: mehwish.fatima@ciitlahore.edu.pk Website: https://sites.google.com/a/ciitlahore.edu.pk/ict/
More informationFundamentals of Programming
Fundamentals of Programming Lecture 2 Number Systems & Arithmetic Lecturer : Ebrahim Jahandar Some Parts borrowed from slides by IETC1011Yourk University Common Number Systems System Base Symbols Used
More informationEE 109 Unit 3. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL
3. 3. EE 9 Unit 3 Binary Representation Systems ANALOG VS. DIGITAL 3.3 3. Analog vs. Digital The analog world is based on continuous events. Observations can take on any (real) value. The digital world
More informationChapter 2 Number System
Chapter 2 Number System Embedded Systems with ARM CortextM Updated: Tuesday, January 16, 2018 What you should know.. Before coming to this class Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2
More information5/17/2009. Digitizing Discrete Information. Ordering Symbols. Analog vs. Digital
Chapter 8: Bits and the "Why" of Bytes: Representing Information Digitally Digitizing Discrete Information Fluency with Information Technology Third Edition by Lawrence Snyder Copyright 2008 Pearson Education,
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012
CMSC 33 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 2, FALL 22 TOPICS TODAY Bits of Memory Data formats for negative numbers Modulo arithmetic & two s complement Floating point formats
More informationPositional Number System
Positional Number System A number is represented by a string of digits where each digit position has an associated weight. The weight is based on the radix of the number system. Some common radices: Decimal.
More informationUnit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation
3.1 3.2 Unit 3 Binary Representation ANALOG VS. DIGITAL 3.3 3.4 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based
More informationCMSC 313 Lecture 03 Multiplebyte data bigendian vs littleendian sign extension Multiplication and division Floating point formats Character Codes
Multiplebyte data CMSC 313 Lecture 03 bigendian vs littleendian sign extension Multiplication and division Floating point formats Character Codes UMBC, CMSC313, Richard Chang 45 Chapter
More informationEE 109 Unit 2. Analog vs. Digital. Analog vs. Digital. Binary Representation Systems ANALOG VS. DIGITAL
EE 9 Unit Binary Representation Systems ANALOG VS. DIGITAL Analog vs. Digital The analog world is based on continuous events. Observations can take on any (real) value. The digital world is based on discrete
More informationChapter 3. Information Representation
Chapter 3 Information Representation Instruction Set Architecture APPLICATION LEVEL HIGHORDER LANGUAGE LEVEL ASSEMBLY LEVEL OPERATING SYSTEM LEVEL INSTRUCTION SET ARCHITECTURE LEVEL 3 MICROCODE LEVEL
More informationCSE1520R Test #1. The exam is closed book, closed notes, and no aids such as calculators, cellphones, etc.
9 February 2011 CSE1520R Test #1 [7F] w/ answers p. 1 of 8 CSE1520R Test #1 Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 45 minutes Term: Winter 2011 The
More informationCSE1520R Test #1. The exam is closed book, closed notes, and no aids such as calculators, cellphones, etc.
9 February 2011 CSE1520R Test #1 [B4] p. 1 of 8 CSE1520R Test #1 Sur / Last Name: Given / First Name: Student ID: Instructor: Parke Godfrey Exam Duration: 45 minutes Term: Winter 2011 The exam is closed
More informationThe Binary Number System
The Binary Number System Robert B. Heckendorn University of Idaho August 24, 2017 Numbers are said to be represented by a placevalue system, where the value of a symbol depends on where it is... its place.
More informationUnit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions. Mr. Dave Clausen La Cañada High School
Unit 3, Lesson 2 Data Types, Arithmetic,Variables, Input, Constants, & Library Functions Mr. Dave Clausen La Cañada High School Vocabulary Variable A variable holds data that can change while the program
More informationSimple Data Types in C. Alan L. Cox
Simple Data Types in C Alan L. Cox alc@rice.edu Objectives Be able to explain to others what a data type is Be able to use basic data types in C programs Be able to see the inaccuracies and limitations
More information3.1. Unit 3. Binary Representation
3.1 Unit 3 Binary Representation ANALOG VS. DIGITAL 3.2 3.3 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based on discrete
More informationOberon Data Types. Matteo Corti. December 5, 2001
Oberon Data Types Matteo Corti corti@inf.ethz.ch December 5, 2001 1 Introduction This document is aimed at students without any previous programming experience. We briefly describe some data types of the
More informationplc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums
plc numbers  3. 3. NUMBERS AND DATA Topics: Number bases; binary, octal,, hexa Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;
More informationCSC 8400: Computer Systems. Represen3ng and Manipula3ng Informa3on. Background: Number Systems
CSC 8400: Computer Systems Represen3ng and Manipula3ng Informa3on Background: Number Systems 1 Analog vs. Digital System q Analog Signals  Value varies con1nuously q Digital Signals  Value limited to
More informationEE 109 Unit 2. Binary Representation Systems
EE 09 Unit 2 Binary Representation Systems ANALOG VS. DIGITAL 2 3 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013 TOPICS TODAY Bits of Memory Data formats for negative numbers Modulo arithmetic & two s complement Floating point
More informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationFundamental Data Types
Fundamental Data Types Lecture 4 Sections 2.72.10 Robb T. Koether HampdenSydney College Mon, Sep 3, 2018 Robb T. Koether (HampdenSydney College) Fundamental Data Types Mon, Sep 3, 2018 1 / 25 1 Integers
More informationBinary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example
The Basics Binary Numbers Part Bit of This and a Bit of That What is a Number? Base Number We use the HinduArabic Number System positional grouping system each position represents a power of Binary numbers
More information2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme
2a. Codes and number systems (continued) How to get the binary representation of an integer: special case of application of the inverse Horner scheme repeated (integer) division by two. Example: What is
More informationASSIGNMENT 5 TIPS AND TRICKS
ASSIGNMENT 5 TIPS AND TRICKS linearfeedback shift registers Java implementation a simple encryption scheme http://princeton.edu/~cos26 Last updated on /26/7 : PM Goals OOP: implement a data type; write
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012 ANNOUNCEMENTS TA Office Hours (ITE 334): Genaro Hernandez, Jr. Mon 10am 12noon Roshan Ghumare Wed 10am 12noon Prof.
More informationExercises Software Development I. 03 Data Representation. Data types, range of values, internal format, literals. October 22nd, 2014
Exercises Software Development I 03 Data Representation Data types, range of values, ernal format, literals October 22nd, 2014 Software Development I Wer term 2013/2014 Priv.Doz. Dipl.Ing. Dr. Andreas
More informationSource coding and compression
Computer Mathematics Week 5 Source coding and compression College of Information Science and Engineering Ritsumeikan University last week binary representations of signed numbers signmagnitude, biased
More informationUNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES
UNIT 2 NUMBER SYSTEM AND PROGRAMMING LANGUAGES Structure 2.0 Introduction 2.1 Unit Objectives 2.2 Number Systems 2.3 Bits and Bytes 2.4 Binary Number System 2.5 Decimal Number System 2.6 Octal Number System
More informationDigital Representation
Special guests today: Informatics students: Benji SchwartzGilbert Ryan Musgrave DevynJones Announcements Why is BYTE spelled with a Y? Why "BYTE" The Engineers at IBM were looking for a word for a quantity
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted onepage formula sheet. No calculators or other electronic devices
More informationCPSC 301: Computing in the Life Sciences Lecture Notes 16: Data Representation
CPSC 301: Computing in the Life Sciences Lecture Notes 16: Data Representation George Tsiknis University of British Columbia Department of Computer Science Winter Term 2, 20152016 Last updated: 04/04/2016
More informationChapter 8. Characters and Strings
Chapter 8 Characters and s OJECTIVES After you have read and studied this chapter, you should be able to Declare and manipulate data of the char data type. Write string processing programs using and uffer
More informationChapter 3: Arithmetic for Computers
Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101002 2 The Binary Numbering
More informationNumber Systems II MA1S1. Tristan McLoughlin. November 30, 2013
Number Systems II MA1S1 Tristan McLoughlin November 30, 2013 http://en.wikipedia.org/wiki/binary numeral system http://accu.org/index.php/articles/18 http://www.binaryconvert.com http://en.wikipedia.org/wiki/ascii
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted onepage formula sheet. No calculators or other electronic devices
More informationCS101 Lecture 04: Binary Arithmetic
CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary
More informationDo not start the test until instructed to do so!
Instructions: Print your name in the space provided below. This examination is closed book and closed notes, aside from the permitted onepage formula sheet. No calculators or other electronic devices
More informationChapter 7. Binary, octal and hexadecimal numbers
Chapter 7. Binary, octal and hexadecimal numbers This material is covered in the books: Nelson Magor Cooke et al, Basic mathematics for electronics (7th edition), Glencoe, Lake Forest, Ill., 1992. [Hamilton
More informationIntroduction to Decision Structures. Boolean & If Statements. Different Types of Decisions. Boolean Logic. Relational Operators
Boolean & If Statements Introduction to Decision Structures Chapter 4 Fall 2015, CSUS Chapter 4.1 Introduction to Decision Structures Different Types of Decisions A decision structure allows a program
More informationExperiment 3. TITLE Optional: Write here the Title of your program.model SMALL This directive defines the memory model used in the program.
Experiment 3 Introduction: In this experiment the students are exposed to the structure of an assembly language program and the definition of data variables and constants. Objectives: Assembly language
More informationLecture (09) x86 programming 8
Lecture (09) x86 programming 8 By: Dr. Ahmed ElShafee 1 Basic Input Output System BIOS BIOS refers to a set of procedures or functions that enable the programmer have access to the hardware of the computer.
More informationCS341 *** TURN OFF ALL CELLPHONES *** Practice NAME
CS341 *** TURN OFF ALL CELLPHONES *** Practice Final Exam B. Wilson NAME OPEN BOOK / OPEN NOTES: I GIVE PARTIAL CREDIT! SHOW ALL WORK! 1. Processor Architecture (20 points) a. In a Harvard architecture
More informationA complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation
Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers
More informationData Representation 1
1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation
More informationCHAPTER V NUMBER SYSTEMS AND ARITHMETIC
CHAPTER V1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V2 NUMBER SYSTEMS RADIXR REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(
More informationPureScan  ML1. Configuration Guide. Wireless Linear Imager Wireless Laser scanner  1 
PureScan  ML1 Wireless Linear Imager Wireless Laser scanner Configuration Guide  1  Table of Contents Chapter 1 System Information 1.1 About this manual 3 1.2 How to set up the parameter 3 Chapter 2
More informationVariables and data types
Programming with Python Module 1 Variables and data types Theoretical part Contents 1 Module overview 4 2 Writing computer programs 4 2.1 Computer programs consist of data and instructions......... 4 2.2
More informationThe type of all data used in a C++ program must be specified
The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are
More informationMidterm CSE 131 Winter 2012
Login Name Signature _ Name Student ID Midterm CSE 131 Winter 2012 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 (22 points) (29 points) (25 points) (34 points) (20 points) (18 points) Subtotal (148 points
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted
More information10.1. Unit 10. Signed Representation Systems Binary Arithmetic
0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system
More informationEXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART)
EXPERIMENT 8: Introduction to Universal Serial Asynchronous Receive Transmit (USART) Objective: Introduction To understand and apply USART command for sending and receiving data Universal Serial Asynchronous
More informationTable of Contents Sleep Settings How to Configure the Scanner. 7 Chapter 2 System Setup
Table of Contents Chapter 1 System Information 1.1 Setup Scanner with PC 1.2 Setup Scanner with Mobile Device 1.3 Configure ios OnScreen Keyboard 1.4 Memory Mode 3 4 4 5 1.5 Sleep Settings 6 1.6 How to
More informationDecimal & Binary Representation Systems. Decimal & Binary Representation Systems
Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001
More informationImperial College London Department of Computing
Imperial College London Department of Computing Architecture SELFSTUDY NOTES January 2018 Integers and Characters (1) SelfStudy Welcome to the Computer Architecture course. These notes cover basic topics
More informationCHW 261: Logic Design
CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER
More informationHardware. ( Not so hard really )
Hardware ( Not so hard really ) Introduction to Computers What is a computer? Why use a computer anyway? Do they have limitations? What s next? A bit of history Mechanical Early 1614 1643 1673 Abacus Slide
More informationEXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART)
EXPERIMENT 7: Introduction to Universal Serial Asynchronous Receive Transmit (USART) Objective: To understand and apply USART command for sending and receiving data Introduction Universal Serial Asynchronous
More informationData Representation COE 301. Computer Organization Prof. Muhamed Mudawar
Data Representation COE 30 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Positional Number
More informationvoid mouseclicked() { // Called when the mouse is pressed and released // at the same mouse position }
Review Commenting your code Random numbers and printing messages mousex, mousey void setup() & void draw() framerate(), loop(), noloop() Arcs, curves, bézier curves, beginshape/endshape Example Sketches
More informationHexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those?
9/10/18 1 Binary and Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those? Hexadecimal Numbers Check Homework 3 Binary Numbers A binary (basetwo) number
More information= Chapter 1. The Binary Number System. 1.1 Why Binary?
Chapter The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base0 system. When you
More informationCSE 30 Spring 2007 Final Exam
Login: cs30x Student ID Name Signature CSE 30 Spring 2007 Final Exam 1. Number Systems (25 points) 2. Binary Addition/Condition Code Bits/Overflow Detection (12 points) 3. Branching (19 points) 4. Bit
More informationn NOPn Unary no operation trap U aaa NOP Nonunary no operation trap i
Instruction set Instruction Mnemonic Instruction Addressing Status Specifier Mode Bits 0000 0000 STOP Stop execution U 0000 0001 RET Return from CALL U 0000 0010 RETTR Return from trap U 0000 0011 MOVSPA
More informationIT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1
IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose
More informationCMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts
CMPSCI 145 MIDTERM #1 Solution Key NAME SPRING 2017 March 3, 2017 PROBLEM SCORE POINTS 1 10 2 10 3 15 4 15 5 20 6 12 7 8 8 10 TOTAL 100 10 Points Examine the following diagram of two systems, one involving
More informationMidterm CSE 131 Winter 2013
Login Name Signature _ Name Student ID Midterm CSE 131 Winter 2013 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 (21 points) (21 points) (21 points) (23 points) (18 points) (24 points) Subtotal (128 points
More informationNumber Systems. Both numbers are positive
Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of
More informationSigned umbers. Sign/Magnitude otation
Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,
More informationNumber Systems CHAPTER Positional Number Systems
CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of
More informationUser s Manual. Xi3000 Scanner. Table of Contents
Xi3000 Scanner User s Manual Table of Contents Restore Default Settings... 1 Exit Setup without Changes... 1 Configure Through RS232... 1 List Setting... 1 Buzzer Settings... 2 Reading Redundancy Setting...
More informationCSE 30 Spring 2006 Final Exam
cs30x_ Student ID Name _ Signature CSE 30 Spring 2006 Final Exam 1. Number Systems _ (15 points) 2. Binary Addition/Condition Code Bits/Overflow Detection _ (12 points) 3. Branching _ (18 points) 4. Bit
More informationNumeral Systems. Numeral System Positional systems Decimal Binary Octal. Subjects:
Numeral Systems Numeral System Positional systems Decimal Binary Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical
More informationMACHINE LEVEL REPRESENTATION OF DATA
MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems
More informationCSE 30 Fall 2013 Final Exam
Login: cs30x Student ID Name Signature By filling in the above and signing my name, I confirm I will complete this exam with the utmost integrity and in accordance with the Policy on Integrity of Scholarship.
More informationBits, Words, and Integers
Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are
More informationIntroduction to Numbering Systems
NUMBER SYSTEM Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems that we will work with are Binary Base 2 Octal Base 8 Hexadecimal
More information