Chapter 2 Data Representations
|
|
- Gervase Douglas
- 6 years ago
- Views:
Transcription
1 Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/ Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers Negative numbers Fixed-point and floating-point numbers Tradeoff between Number of Significant Digits and Range Characters Basic Operations defined for individual data representations Addition, subtraction, multiplication, division 4/21/
2 Fundamental Principle of Computers Binary states on/off controlled by a (mechanical and/or electrical) switch correspond to 0 /1 (or True/False), and all the operations are processed in the binary system for computers ON 1 OFF 0 Switch Quantity (analog data) is convreted into digital (discrete) data in a computer Decimal Analog Binary Digital 4/21/ Binary Representation Decimal Number Sequence of digits Base-10 system Binary Numbers Sequence of Bits Base-2 system (binary digit) Base-10 system Base-2 system Carry up in counting binary numbers Correspondence between decimal numbers and binary numbers 4/21/
3 Representation of Binary Numbers in Computers Fixed number of bits used for data representations and operations Computer jargon 1 byte = 8 bits 1 word: a fixed-sized group of bits that are handled together by a computer A 32-bit computer use 32 bits as a word and handles 32-bit data as a unit for operations MSB(Most Significant Bit): leftmost bit of a word/byte LSB(Least Significant Bit): rightmost bit of a word/byte Bit sequence Upper Word Lower word 32-bit for a 32-bit computer 4/21/ Binary Decimal Conversion n-bit unsigned binary integer number a n-1 a n-2 a 2 a 1 a 0 is converted into a positive integer N= a n-1 2 n-1 + a n-2 2 n a a a n -1 N 0 n-bit unsigned binary fraction number a n-1 a n-2 a 2 a 1 a 0 a -1 a Binary point -2 is converted into a positive decimal fraction N N= a n-1 2 n-1 + a n-2 2 n-2 + a a a a a /21/
4 Decimal Binary Conversion Decimal Number N is converted into n-bit binary number a n-1 a n-2 a 2 a 1 a 0 N = a n-1 2 n-1 + a n-2 2 n-2 + a a a =2(a n-1 2 n-2 + a n-2 2 n-1 + a a 1 )+ a 0 =2N 1 + a 0 =2(2(2N 2 + a 1 )+ a 0 =2(2(2( 2(2N n + a n-1 )+ a n-2 )+... a 1 )+ a 0, Here, N n =0 N i = 2N i+1 + a i, N 0 = N, i=0,1,2,...,n-1 Question: Binary representation of a decimal number N=43?? 4/21/ Decimal Binary Conversion (Cont d) Decimal fraction number N is converted into n-bit binary fraction number 0.a -1 a -2 a 1-n a -n N= a a a 1-n 2 1-n + a -n 2 -n = (a -1 + a a n + a n ) 2-1 = (a -1 +N ) 2-1 = (a -1 + (a -2 +N ) 2-1 ) 2-1 = (a -1 + (a (a -n +N -n 2-1 ) 2-1 ) ) 2-1, whre, N -n =0 N -i = a -i-1 + N -i-1 2-1, N 0 = N, i=0,1,2,...,n-1 Question: Binary representation of decimal fraction number /21/
5 Binary-Decimal Conversion: Examples Binary Translation of Binary Translation of 2X 4/21/ Base-2 Arithmetic 1-bit binary addition a + b sum carry N-bit addition 1-bit binary subtraction a - b difference borrow N-bit subtraction 4/21/
6 Multiplication paper&pencil method Multiplication of 1-bit binary numbers a x b product 2n-bit required when multiplying two n-bit numbers (n bits x m bits generates n+m bits) 4/21/ Division on Binary Numbers Division on n-bit numbers paper&pencil method 2n-bit number (dividend) divided by a n-bit number(divisor) generates a n-bit quotient ;remainder 4/21/
7 Negative Integers Sing-Magnitude Representation MSB (named the sign bit) is used to indicate whether the number is positive or negative, and the remainder of the number indicates the absolute value (or magnitude) of the number binary 8 decimal binary 8 decimal Features Can represent the numbers from -(2 n-1-1) to +(2 n-1-1) For example, 8-bit can represent -127( ) 127( ) Easy to understand Two representations of and Special care needed for addition and subtraction Separate handling of sing and magnitude bits for arithmetic operations 4/21/ Addition on Sing-Magnitude Numbers Rules for X+Y If the signs of X and Y are same X+Y= sign of X X Y, X is the absolute value of X If the signs of X and Y are different If X Y is positive, X+Y= sign of X X Y If X Y is negative, X+Y= sign of Y Y X Rules for X-Y If the signs of X and Y are same, Rule is applied. If the signs of X and Y are different, Rule is applied. 4/21/
8 Addition on Sing-Magnitude Numbers: Examples Numbers in are decimal representations 4/21/ Another Representation of Negative Numbers Motivation: number representation for simple and unified operations of addition and subtraction General definition of Complement Complement of N means the number that generates a carry when adding N to its complement E.g., in case of decimal, complement of 3 is 7. Complement number representation simplifies addition and subtraction Example: 1 digit subtraction complement of 3 subtraction result by ignoring a carry 4/21/
9 Two s Complement Notation Two s complement representation of A in n-bit is 2 n A Allocate an n-bit number for a negative number as its complement so that N (n-bit) + complement number of N (n-bi) =1000 0(n+1-bit) =00000(nbit) Discarding any overflow bits that do not fit in the width (i.e., n-bit) of representation How to obtain the complement of a number Inverting each bit of the unsigned representation of the number and adding 1 to the result 2 n 1 N 2 n Two s complement of 0110 (6)??? MSB is the sign bit. is uniquely defined. (no +0/-0) Unified handling of addition and subtraction 4/21/ Number Representations Decimal Sign+Magnitude Two s complement N/A Circular N/A 4/21/
10 Two s Complement Translation Example Two s complement representation of A in n-bit is 2 n A Inverting each bit of the unsigned representation of the number and adding 1 to the result A=2 n - A=(2 n 1 A ) + 1 Obtained by negation of each bit Example 8-bit case Decimal Sign+Mag. Two s Complement 4/21/ Additions and Subtractions on Complement Numbers n-bit subtractions are processed by a b = a + (-b) = a +(2 n b) 2 n No need to separately handle the sign bit Unified operations of additions and subtractions when using complement numbers Negative results obtained in the compliment notation How to calculate a - b 1. Obtain two s compliment b c of b 2. Result obtained by adding a to b c If there is a carry from MSB (overflow from n-bit), ignore it. Negative results are also represented in the compliment notation. 4/21/
11 Examples Exercise Calculate the following expressions in 8-bit number representation with two s complements for negative numbers (-13)= = 3. 9-(-13)= = 4/21/ Hexadecimal & Octal Numbers Binary representation is simple but need more bits to represent numbers compared to decimal representation. Hexadecimal (base-16) notation 0,1,2,3,4,5,6,7,8,9,A(10), B(11), C(12), D(13), E(14),F(15) Binary used as a hexadecimal digit One hexadecimal digit corresponds to four bits Example, 0x1af9 Octal(base-8) notation Hexadecimal A F used as an octal digit Binary One octal digit corresponds to three bits Example, 0o644 Octal 4/21/
12 BCD Representation Binary-Coded Decimal (BCD) Representation Decimal numbers are presented digit by digit in the binary form 4 bits are needed to represent decimal digit from 0 to 9 No error occur in representation of fraction numbers Decimal BCD 1010 to1111 are not used Redundant coding Example /21/ Additions on BCD Numbers Add 4-bit (BCD digit) by 4-bit from the lower As there is unused range from 1010 to 1111, if a result of addition of each digit is greater than 9, add offset 110(6) for compensation and carry generation >1010 carry Add offset 110 Add offset 110 4/21/
13 Subtraction on BCD Numbers Subtract 4-bit (BCD digit) by 4-bit from the lower If subtraction of each digit needs a borrow from the upper digit and a subtraction result is greater than 9, subtract offset 110(6) for compensation borrow >1010 Sub offset 4/21/ Floating-Point Numbers Fixed-point notation Binary point is fixed, e.g., rightmost for integers Easy for arithmetic operations Representable range limited Floating-point notation Numbers are presented by a mantissa (significand) and an exponent, similar to scientific notation Representable range extended Complicated processing needed for arithmetic operations sign n-bit (fixed) Integer part p-bit (fixed) Mantissa (Significand) m-bit (fixed) Fraction part Binary point (fixed) q-bit (fixed) exponent 4/21/
14 Normalization of Floating-Point Numbers In the floating-point notation, a number is normalized to effectively use mantissa s bits for floating-point representation (without redundant 0 s) mantissa A real number is called normalized, if it is in the form where b is the base number, and E.g. Normalized numbers (IEEE 745 representation) Non-normalized numbers , , /21/ Normalization of Non-Normalized Numbers Multiplication and division by the base number (e.g., 2 or 10) and add/sub exponent value by the number of shifted bits. 1. Shift significand bits to left (or right), and 2. Sub(or add) exponent value by the number of shifted bits. Remark Left-shift&sub (or rightshift&add) means 1/2 (or 2x) in the base-2 system Non-normalized numbers 3-bit shift left 5-bit shift right (5-3= 2) = x x2-1 Normalized numbers 4/21/
15 IEEE745: Standard Format for Floating-Point Data Representation Single-Precision Format (-1) S (1+significand) 2 (exponent - 127) s (exponent) (significand) 1bit 8 bits 23 bits Double-Precision Format (-1) S (1+significand) 2 (exponent ) s (exponent) (significand) 1bit 11 bits 20 bits (significand)( 32 bits 4/21/ Summary of IEEE745 Format (Cont d) 4/21/
16 Features of IEEE 754 Format To pack even more bits into the significand, make the leading 1 bit of normalized binary numbers explicit. 24-bit precision with the 23-bit field for singleprecision, 53-bit precision with 52-bit fileld for doubleprecision Significand is used to represent a fraction between 0 and 1 Sign+magnitude representation for significand Sign bit is separately stored in MSB, allowing a quick test of less than, greater than, or equal to 0 Easily processed by integer comparisons, especially for sorting needed in floating-point operations Biased exponent To compare exponents of two numbers for floating-point operation quickly by integer comparison, exponents are biased so that the most negative exponent is , and the most positive exponent is Biases of 127 for single-precision, 1023 for double-precision De-normalized numbers 0.f 2 Emin ) are representable to minimize underflows Infinity( ) can be handled, e.g., 1/0 returns NaN: Not a Number NaN is used as a special symbol for unrepresentable results obtained by some invalid operations such as 0/0, Almost all computers use IEEE 754 format for floating-point data representation! 4/21/ Some Examples in Two s Complement Format in Two s Complement Format in IEEE in IEEE in IEEE in IEEE /21/
17 Floating-Point Addition/Subtraction Addition and subtraction of two numbers m 1 2 e1, m 2 2 e2 (e 1 >e 2 ) Step 1 To align the binary point of the number that has the smaller exponent to the larger exponent, calculate e 1 -e 2 Step 2 The significand of the number with lesser exponent is shifted right, in this case, by (e1-e2) bits Step 3 Add the significands Step 4 Normalization by shifting significands right/left, and increment/ decrement exponents accordingly Step 5 Checking for overflow/underflow Step 6 Rounding if necessary 4/21/ Overflow and Underflow An overflow or underflow occurs when an operation generates a result that cannot be expressed in the format The bit width of a computer limits the maximum and minimum numbers it can represent in the given format Overflows occur when the result of an operation is too large to represent in the input format E.g., a result obtained by division of a large number by an extremely small number Underflows occur when the result of an operation is too small to represent in the input format E.g., a result obtained by division of a small number by extremely large number A special signal (e.g., NaN of IEEE 754) generated to notify system/ programmer when overflows or underflows occur Abnormal termination of the program. NaN (Not a Number) 4/21/
18 Floating-Point Addition/Subtraction Addition and subtraction of two numbers m 1 2 e1, m 2 2 e2 (e 1 >e 2 ) Step 1 To align the binary point of the number that has the smaller exponent to the larger exponent, calculate e 1 -e 2 Step 2 The significand of the number with lesser exponent is shifted right, in this case, by (e1-e2) bits Step 3 Add the significands Step 4 Normalization by shifting significands right/left, and increment/ decrement exponents accordingly Step 5 Checking for overflow/underflow Step 6 Rounding if necessary 4/21/ Rounding Rounding is needed to fit a given number into the fixed significant digits Round to Nearest (default in IEEE745) Rounds to the nearest value; if the number falls midway it is rounded to the nearest value with an even (zero) least significant bit. Round toward Directed rounding towards positive infinity Round toward Representable numbers in n-bit Directed rounding towards negative infinity Round toward 0 Directed rounding towards zero? 1? Result obtained by operation 4/21/
19 Example of Floating-Point Addition Addition of 0.5 ten and ten Step ten 1/2 ten 1/2 1 ten =0.1 two =0.1 two 2 0 =1.000 two ten =-7/16 ten =-7/2 4 ten = two = two 2 0 = two 2-2 Step 1&2 Exponent alignment -1-(-2)=1: 1bit shift two 2-2 = two 2-1 Step 3 addition of significands two 2-1 ( two 2-1) =0.001 two 2-1 Step 4 Normalization two 2-1 =0.010 two 2-2 =0.010 two 2-3 =1.000 two 2-4 Step 5 Checking for overflow/ underflow, and rounding No overflow/underflow because of The result of addition two 2-4 = two =1/2 4 ten =1/16 ten = ten 4/21/ Multiplication/Division of Floating-Point Numbers Multiplication: m 1 2 e1 m 2 2 e2 m 1 m 2 2e1 e2 Step 1 Add exponents of two inputs Step 2 Multiply their significands Step 3 Normalization and overflow/ underflow check of the product Step 4 Rounding Step 5 Sign calculation The sign of the product depends on the signs of the original operands (two inputs) If they are both the same, the sign is positive; otherwise it s negative Division m 1 2 e1 m 2 2 e2 m 1 m 2 2e1 e2 Step 1 Subtract the exponents of dividend from divisor Step 2 Divide significands of dividend by that of divisor Step 3 Normalization and overflow/ underflow check of the quotient Step 4 Rounding Step 5 Sign calculation The sign of the product depends on the signs of the original operands (two inputs) If they are both the same, the sign is positive; otherwise it s negative 4/21/
20 Example of Floating-Point Multiplication Multiplication Step 1 Add exponents of two inputs Step 2 Multiply their significands Step 3 Normalization and overflow/underflow check of the product Step 4 Rounding Step 5 Sign calculation The sign of the product depends on the signs of the original operands (two inputs) If they are both the same, the sign is positive; otherwise it s negative Example Multiplication of 0.5 ten two 2-1 and ten = two 2-2 Step (-2) = -3 Step two two = two Step 3 No underflow/overflow occurs because of Step 4 No rounding needed because the product fit into 4 bits Step 5 The product is negative because the signs of two inputs are different. The product is two 2-3 = two -7/2 5 ten =-7/32 ten = ten 4/21/ Representation of Characters and Symbols Encoding characters based on the alphabetical(or order; Assign a bit sequence to each character An 8-bit code defines 256 characters A16-bit code defines characters Sorting of characters available by simply comparing numbers defined for characters Smaller numbers assigned for earlier ordered characters in abc Character type of data defined at the programming level. Typical Coding Systems ASCII(American Standard Code for Information Interchange) 7-bit for 128 printable and nonprintable characters Widely used for current computers JIS (Japan Industrial Standard) Kana-kanji extension of ASCII 2 bytes (16 bits) EBCDIC(Extended Binary Coded Decimal Interchange Code) IBM code specially-defined for main-frame computers 4/21/
21 Lower bits Upper bits 4/21/ Data Types Used in Computer Numbers Integer Real numbers Fixed-point numbers Floating-point numbers Unsigned numbers Signed numbers Positive numbers Negative numbers Characters String: a sequence of characters All these data represented in a sequence of bits - no difference in appearance, and data type is defined at the programming level 4/21/
Data Representations & Arithmetic Operations
Data Representations & Arithmetic Operations Hiroaki Kobayashi 7/13/2011 7/13/2011 Computer Science 1 Agenda Translation between binary numbers and decimal numbers Data Representations for Integers Negative
More informationModule 2: Computer Arithmetic
Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N
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 informationFloating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3
Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part
More informationDivide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
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 informationChapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers
Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers
More informationNumber Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column
1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
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 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 informationFloating Point. The World is Not Just Integers. Programming languages support numbers with fraction
1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in
More informationNumber Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:
N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a
More informationUNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666
UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation
More informationCO212 Lecture 10: Arithmetic & Logical Unit
CO212 Lecture 10: Arithmetic & Logical Unit Shobhanjana Kalita, Dept. of CSE, Tezpur University Slides courtesy: Computer Architecture and Organization, 9 th Ed, W. Stallings Integer Representation For
More informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Arithmetic Unit 10122011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Fixed Point Arithmetic Addition/Subtraction
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 informationChapter 4. Operations on Data
Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations
More informationSigned Multiplication Multiply the positives Negate result if signs of operand are different
Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result
More informationNumber Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010
Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER
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 informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
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 35101-002 2 The Binary Numbering
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationFLOATING POINT NUMBERS
Exponential Notation FLOATING POINT NUMBERS Englander Ch. 5 The following are equivalent representations of 1,234 123,400.0 x 10-2 12,340.0 x 10-1 1,234.0 x 10 0 123.4 x 10 1 12.34 x 10 2 1.234 x 10 3
More informationOrganisasi Sistem Komputer
LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles
More informationFloating Point Arithmetic
Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678
More informationChapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude
Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) (aritmeettis-looginen yksikkö) Does all
More informationChapter 5 : Computer Arithmetic
Chapter 5 Computer Arithmetic Integer Representation: (Fixedpoint representation): An eight bit word can be represented the numbers from zero to 255 including = 1 = 1 11111111 = 255 In general if an nbit
More informationComputer Arithmetic Ch 8
Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen
More informationIntroduction to Computers and Programming. Numeric Values
Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000
More informationKinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other
Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers
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 informationOperations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions
CHAPTER 4 Operations On Data (Solutions to Odd-Numbered Problems) Review Questions 1. Arithmetic operations interpret bit patterns as numbers. Logical operations interpret each bit as a logical values
More information1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More information1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM
1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number
More informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
More informationC NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.
C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an
More informationNumber representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or
More informationLecture 2: Number Systems
Lecture 2: Number Systems Syed M. Mahmud, Ph.D ECE Department Wayne State University Original Source: Prof. Russell Tessier of University of Massachusetts Aby George of Wayne State University Contents
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting
More informationUNIT-III COMPUTER ARTHIMETIC
UNIT-III COMPUTER ARTHIMETIC INTRODUCTION Arithmetic Instructions in digital computers manipulate data to produce results necessary for the of activity solution of computational problems. These instructions
More informationBINARY SYSTEM. Binary system is used in digital systems because it is:
CHAPTER 2 CHAPTER CONTENTS 2.1 Binary System 2.2 Binary Arithmetic Operation 2.3 Signed & Unsigned Numbers 2.4 Arithmetic Operations of Signed Numbers 2.5 Hexadecimal Number System 2.6 Octal Number System
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting
More informationCS 101: Computer Programming and Utilization
CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.
More informationCOMPUTER ORGANIZATION AND. Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers
ARM D COMPUTER ORGANIZATION AND Edition The Hardware/Software Interface Chapter 3 Arithmetic for Computers Modified and extended by R.J. Leduc - 2016 In this chapter, we will investigate: How integer arithmetic
More informationChapter 10 - Computer Arithmetic
Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation
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 informationDigital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals CHAPTER 2 Number Systems, Operations, and Codes Decimal Numbers The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The decimal numbering system has a base of
More informationDIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM
COURSE / CODE DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) NUMBER SYSTEM A considerable subset of digital systems deals with arithmetic operations. To understand the
More informationInternal Data Representation
Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information
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 informationUNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS
UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and
More informationCHAPTER V NUMBER SYSTEMS AND ARITHMETIC
CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(
More informationAdding Binary Integers. Part 5. Adding Base 10 Numbers. Adding 2's Complement. Adding Binary Example = 10. Arithmetic Logic Unit
Part 5 Adding Binary Integers Arithmetic Logic Unit = Adding Binary Integers Adding Base Numbers Computer's add binary numbers the same way that we do with decimal Columns are aligned, added, and "'s"
More informationFloating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.
Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum
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 informationNumber Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example
Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationUNIT 7A Data Representation: Numbers and Text. Digital Data
UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with
More informationEE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring
EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationFloating-point representations
Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010
More informationThe ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.
CS 320 Ch 10 Computer Arithmetic The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. Signed integers are typically represented in sign-magnitude
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 informationVTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y
Arithmetic A basic operation in all digital computers is the addition and subtraction of two numbers They are implemented, along with the basic logic functions such as AND,OR, NOT,EX- OR in the ALU subsystem
More informationChapter 2. Data Representation in Computer Systems
Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting
More informationCourse Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation
Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep
More informationFloating-Point Arithmetic
ENEE446---Lectures-4/10-15/08 A. Yavuz Oruç Professor, UMD, College Park Copyright 2007 A. Yavuz Oruç. All rights reserved. Floating-Point Arithmetic Integer or fixed-point arithmetic provides a complete
More information±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j
ENEE 350 c C. B. Silio, Jan., 2010 FLOATING POINT REPRESENTATIONS It is assumed that the student is familiar with the discussion in Appendix B of the text by A. Tanenbaum, Structured Computer Organization,
More informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More informationA Level Computing. Contents. For the Exam:
A Level Computing Contents For the Exam:... 1 Revision of Binary... 2 Computing Mathematics Revision... 2 Binary Addition/Subtraction revision... 3 BCD... 3 Sign and Magnitude... 4 2 s Compliment... 4
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text
More informationFloating Point Numbers
Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides
More informationDigital Fundamentals
Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities
More informationComputer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University
Computer Architecture Chapter 3 Fall 2005 Department of Computer Science Kent State University Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point
More information4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning
4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.
More informationChapter 4 Section 2 Operations on Decimals
Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.
More informationFloating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !
Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More informationNumeric Encodings Prof. James L. Frankel Harvard University
Numeric Encodings Prof. James L. Frankel Harvard University Version of 10:19 PM 12-Sep-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved. Representation of Positive & Negative Integral and
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 11: Floating Point & Floating Point Addition Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Last time: Single Precision Format
More informationNumber Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems
More informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
More informationFinal Labs and Tutors
ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South
More informationECE260: Fundamentals of Computer Engineering
Arithmetic for Computers James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Arithmetic for
More informationDigital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.
Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we
More informationFloating Point Representation in Computers
Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things can go wrong What are Floating Point Numbers? Any
More informationPrinciples of Computer Architecture. Chapter 3: Arithmetic
3-1 Chapter 3 - Arithmetic Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 3: Arithmetic 3-2 Chapter 3 - Arithmetic 3.1 Overview Chapter Contents 3.2 Fixed Point Addition
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationComputer Architecture and Organization
3-1 Chapter 3 - Arithmetic Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 3 Arithmetic 3-2 Chapter 3 - Arithmetic Chapter Contents 3.1 Fixed Point Addition and Subtraction
More informationIntroduction to Computer Science-103. Midterm
Introduction to Computer Science-103 Midterm 1. Convert the following hexadecimal and octal numbers to decimal without using a calculator, showing your work. (6%) a. (ABC.D) 16 2748.8125 b. (411) 8 265
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 22-44 Ext. 724 Email: ashraf@ccse.kfupm.edu.sa 3/7/23
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 4: Floating Point Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments for This Week: Lab 1 18-600
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More informationExcerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997
Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers
More information