# Fractional Numbers. Fractional Number Notations. Fixed-point Notation. Fixed-point Notation

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 2 Fractional Numbers Fractional Number Notations Claudio Fornaro Ver. 1.4 Fractional numbers have the form: xxxxxxxxx.yyyyyyyyy where the x es constitute the integer part of the value and the y s the fractional part There are two main methods to encode fractional numbers: fixed-point notation floating-point notation 3 4 Fixed-point Notation Fixed-point notation splits the available n bits in 2 portions: one for the integer part one for the fractional part integer fractional The radix point is not stored (does not uses up bits): its position is just known The number of bits for the integer and the fractional part are chosen before making any calculation Fixed-point Notation If needed: the integer part must be padded with 0es on the left the fractional part must be padded with 0es on the right Examples 5.25 in FX on 4+4 bits: in FX on 6+2 bits: Radix points are supposed here

2 5 6 Fixed-point Notation For relative fractional values, both SM and 2C notations can be used The n bits are then divided into 3 parts: sign (1 bit) integer part (m bits) fractional part (n-m-1 bits) E.g means 1 bit for sign, 7 for the integer part and 8 for the fractional part Operations are the same seen as for integer values, provided that the values have the same format Fixed-point Notation Examples Convert value in FX 2C Convert value in FX 2C Note: when using the 1 st 2C-operation method, 1 must be added to the LSB, not to unity place: C-Operation = Exercises Convert the values as requested FX 2C on 16 bits (1+8+7) FX 2C on 16 bits (1+8+7) from FX 2C (1+7+4) () from FX 2C (1+6+5) () 10 Calculate on FX 2C 16 bits (1+7+8) and identify any overflow ( ) / 2 ( ) * 64 Exercises Solutions Note that the integer part is not the same

3 9 10 Exercises Solutions ( ) / C C C = Radix points are supposed here Exercises Solutions ( ) * C C C = OVERFLOW Radix points are supposed here Fixed-point Uses Fixed-point notation is sometimes used by simulating it with the integer notation that microprocessors use (i.e. 2C) This allows faster computations than operations using floating-point notation (intrinsically slower) Fixed-point Problems Suppose the following (unsigned) values have to be coded using Fixed-point on a total of 8 bits: All of them can be coded in 8 bits, but there is not a unique position for the radix point suitable for all

4 13 14 Fixed-point Problems Suppose you have to represent some fractional values 0 x < 8 using a Fixed-point coding 4+4 bits: The first bit is always 0, and the fractional part is rounded to 4 bits If we could move the fractional point 1 positions to the left, we could have 1 more bit for precision Fixed-point Problems Suppose you have to represent some values with fractional part x.0, x.5 or x.25 only, using a Fixed-point coding 4+4 bits The last two bits are always 00, and the integer part is limited to 15 If we could move the fractional point 2 positions to the right, we could have 2 more bits for the integer part (values up to 63) Fixed-point Problems The problem with Fixed-point notation is the fixed position of the radix point To solve this problem, the radix point must be made movable (floating), this requires that its position be stored along with each number Exponential Notation Exponential notation represents a number as a value (mantissa or significand ) that multiplies a whole power of the base (exponent ) Examples (in decimal): Mantissa = = Exponent =

5 17 18 Exponential Notation Very big and very small values are obtained by just varying the exponent The same value can be expressed in many forms: = = Among these forms, form 0.x (x 0) is chosen to have a unique representation for values, this is called the normalized form Exponential Notation When the number of digits is not enough to store the whole number only the most important (leftmost) digits are stored The most significant digits are thus preserved, but approximation errors are introduced because of truncation Example (only 4 decimal digits): = = Exponential Notation The maximum representation error with n digits is 10 -n relative to the power of the whole part If the whole part power is m : = 10 -n 10 m = 10 m-n which is the power of the rightmost digit (LSD) Exponential Notation Example Suppose the value has only 4 decimal digits (normalized) The whole part is m =6 = = 10 2 (maximum error) This can also be seen by writing the value as a sum of powers: for this value, the error is: = 43 (< 10 2 )

6 21 22 Exponential Notation Example Suppose the value has only 4 decimal digits = The whole part is m = 2 = = 10-6 (maximum error) Writing the value as a sum of powers: for this value, the error is: = = (< 10-6 ) IEEE-P754 Floating-Point The IEEE-P754 standard describes the most common notations used by computer FPUs (Floating-Point Units) to compute floating-point values The two exponential binary floating point notations described have the form mantissa 2 exponent and are: Single precision (SP) Double precision (DP) Single precision values uses 32 bits divided in 3 parts: sign: 1 bit exponent field: 8 bits mantissa (or significand) field: 23 bit s exponent mantissa The sign bit is defined as follows: 0 is used for values 0 1 is used for values 0 (negative zero!) The mantissa (or significand ) is in the normalized form 1.xxxxx, where the 1 before the radix point is the leftmost 1 (MSB) in the binary representation Only the fractional part of the binary mantissa is stored in the mantissa field: the leftmost 1 is already known to be present (called hidden bit ), this allows for one more bit of precision (23 bits stored + 1 hidden = 24 bits effective)

7 25 26 The exponent is a relative integer value on 8 bits, the IEEE-P754 SP standard does not use SM or 2C notations, but a biased notation called excess 127 : the FP exponent field is computed by adding constant value 127 (bias constant ) to the exponent of the normalized value Excess notation is efficient, especially for number comparison The offset value is 2 n 1 1 (n is the number of bits) in order to consider the first half of the range as negative numbers Example: IEEE-P754(SP) sign is positive: sign bit = 0 convert the value to binary = normalize the value = Note: base 2 compute the exponent by adding 127 to the real base 2 exponent 3+127=130= Compose the pieces adding padding 0es Example: convert from IEEE-P754(SP) sign bit = 1 extract the mantissa, add the hidden bit, and convert to decimal = compute the real exponent by subtracting 127 from the extracted exponent = = 31 compose the parts: =

8 29 30 The SP decimal range is: ( ) The decimal exponent varies from 45 to +38, corresponding to a binary exponent from 126 to 127 Values are approximated to 7 decimal digits (corresponding to the 24 bits used by the mantissa) The representation error is the absolute weight of the LSB This is computed by multiplying the weight of the integer part (hidden bit) times the relative weight of the mantissa LSB (i.e. the weight of the LSB with respect to the integer part) This results in adding the exponents = = = = = = The binary exponent varies from 126 to 127, corresponding to excess 127 values from 1 to 254 Exponent values (0) and (255) are used for special numbers: Zeroes Infinities NaNs Denormalized values Zero Exponent= , Mantissa=0 0/ by definition, not by computation, because there is not any 1 for normalization Positive and negative are considered equivalent Infinity Exponent= , Mantissa=0 0/ Operations with infinitives are well defined

9 33 34 Not a Number (NaN) Exponent= , Mantissa 0 0/ <not 00 00> NaNs are used to indicate values that does not represent real numbers There are 2 types of NaNs: Quiet NaNs: denote indeterminate operations (mantissa MSB set), the result of an operation is not mathematically defined Signalling NaNs: denote an invalid operation (mantissa MSB clear) Any operation with NaN yields a NaN result Special Operations N / INF = 0 INF INF = INF N / 0 = INF INF + INF = INF 0 / 0 = NaN INF INF = NaN INF / INF = NaN INF 0 =NaN IEEE-P754 standard allows values in non-normalized form too (denormalized ) Exponent= , Mantissa 0 Hidden bit is now 0 and not 1 The exponent value is considered 126 Value is: 0.mantissa IEEE-P754 Double Precision Double precision notation just extends the SP notation to use 64 bits The differences are: exponent bits: 11 mantissa bits: 52 bias constant: 1023 exponent range: 1022, equivalent decimal range: ( ) with 15 decimal digits denormalized exponent: 1022

10 37 38 IEEE-P754 Compact Notation For ease of writing and copying, floating-point numbers (as any other bit sequence) can be translated to base 16 as they were (they are not!) a pure binary number BFE00000 C3C Convert the following values to/from IEEE-P754: to SP and DP to SP and DP with an absolute precision of 1/ to decimal to decimal EB to decimal Solutions = = 137 = = 1033 = then: SP: in compact form: C4A58800 DP: in compact form: C094B Solutions = 1/1000 n =10 (fractional bits) = = 121 = = 1017 = then: SP: in compact form: 3CB80000 DP: in compact form: 3F

11 41 42 Solutions = = = 1.75 EB = = = = = = = (approx.) the non-approximated value is: Floating-point Addition To add two FP values, these must have the same exponent before adding their mantissas: the smaller value is converted to have the same exponent as the greater (it is de-normalized) As the exponent is increased (e.g. by 3), the mantissa must decrease (right shift 3 bits) to not change the overall value Underflow If the conversion of the smaller value shifts away all of the mantissa bits (including the hidden bit), the value is approximated to 0, thus the operation result is equal to the greater while the smaller is just ignored There is an underflow condition when, adding 2 values, the result is equal to the greater of them Underflow Example in SP must be converted to the form xxx 2 43, this causes a right shift of 25 bits on the mantissa, thus shifting away all the 24 mantissa bits and resulting in 0 Adding up many small values, it is possible that a partial sum becomes so big to cause underflow for each of the subsequent values (only the first part of the values is added up)

12 45 46 Calculate the following operations (IEEE-P754) and express the result in the same compact form, identify any Overflow/Underflow: 2B1A5F20 + 4F1A3BB0 C4A C2B AB102F 709B1BC2 7F F Solution N.1: 2B1A5F E= =86 4F1A3BB E= =158 Difference of exponents= > 24 UNDERFLOW Result: 4F1A3BB Solution N.2: C4A E= =137 (non biased: 10) M= C2B E= =133 (non biased: 6) M= Difference of exponents: = 4 Solution N.2 (continuation): De-normalized mantissa of the 2 nd value to have exponent=10 (4 right shifts): Addition: = Result: C4B18000

13 49 50 Solution N.3 63AB102F 709B1BC E= E=225 Difference of exponents: = > 24 UNDERFLOW Result: F09B1BC2 (SIGN CHANGED!) Solution N.4 7F E=254 (non biased=127) 7F E=254 (non biased=127) Difference of exponents: Solution N.4 (continuation) = Renormalization: Max exponent is 127 OVERFLOW Result: (+Infinity) F Calculate in the IEEE-P754 SP format the following operations with DECIMAL numbers, identify any Overflow/Underflow:

14 53 54 IEEE-P754 Puzzles Solution: Values differ on the LSB The two numbers have 9 decimal digits corresponding to about 9 3=27 bits After normalization, the relative weight of the LSB is 2-27 Having only 24 bits, power 2-27 is discarded The two values are considered equal Result is 0 IEEE-P754 SP Ranges Maximum normalized positive number is with 23 fractional bits If there were all the bits, the value would be: with 127 fractional bits, = Having just 23 fractional bits, the value is approximated to with 23 fractional bits set to 1 and the rightmost =104 bits set to bits set to 1 are value IEEE-P754 SP Ranges Maximum normalized positive value: = ( ) ( )= e+38 Minimum normalized positive number: e 38 IEEE-P754 SP Ranges Maximum denormalized positive number is with 23 fractional bits the rightmost bit power is: = 149 ( ) ( )= Minimum denormalized positive number is with 23 fractional bits the rightmost bit power is: =

15 57 58 IEEE-P754 Puzzles Determine the difference between value 44A58800 and the next one (44A58801) Value in binary is: = Next one differs for just the LSB: Difference is 1 LSB weight = = 2-13 IEEE-P754 Puzzles Determine the range of the consecutive integer values in SP. Values are in the form 1.xx xx with 23 fractional bits (denormals are not integers) 24 bits (hidden bit included) result in 2 24 combinations of bits (0 to ), each corresponds to a value and an appropriate exponent makes it an integer value 2 24 is represented too Range: IEEE-P754 Puzzles Determine the (absolute) representation error for value N= in IEEE-P754 SP. N = requires 63 bits N = 1.xxx 2 62 In SP there are only 23 bits for the mantissa The relative weight of the LSB is =39 The representation error is 2 39

### Integer and Real Numbers Representation in Microprocessor Techniques

Brno University of Technology Integer and Real Numbers Representation in Microprocessor Techniques Microprocessor Techniques and Embedded Systems Lecture 1 Dr. Tomas Fryza 30-Sep-2011 Contents Numerical

### TECH. Arithmetic & Logic Unit. CH09 Computer Arithmetic. Number Systems. ALU Inputs and Outputs. Binary Number System

CH09 Computer Arithmetic CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer Representation Integer Arithmetic Floating-Point Representation

### CPE 323 Data Types and Number Representations

CPE 323 Data Types and Number Representations Aleksandar Milenkovic Numeral Systems: Decimal, binary, hexadecimal, and octal We ordinarily represent numbers using decimal numeral system that has 10 as

### ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

### Digital 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

### Data Representation Binary Numbers

Data Representation Binary Numbers Integer Conversion Between Decimal and Binary Bases Task accomplished by Repeated division of decimal number by 2 (integer part of decimal number) Repeated multiplication

### 2.1 Binary Numbers. 2.3 Number System Conversion. From Binary to Decimal. From Decimal to Binary. Section 2 Binary Number System Page 1 of 8

Section Binary Number System Page 1 of 8.1 Binary Numbers The number system we use is a positional number system meaning that the position of each digit has an associated weight. The value of a given number

### Binary Representation and Computer Arithmetic

Binary Representation and Computer Arithmetic The decimal system of counting and keeping track of items was first created by Hindu mathematicians in India in A.D. 4. Since it involved the use of fingers

### comp 180 Lecture 21 Outline of Lecture Floating Point Addition Floating Point Multiplication HKUST 1 Computer Science

Outline of Lecture Floating Point Addition Floating Point Multiplication HKUST 1 Computer Science IEEE 754 floating-point standard In order to pack more bits into the significant, IEEE 754 makes the leading

### Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

### Number Representation

Number Representation Number System :: The Basics We are accustomed to using the so-called decimal number system Ten digits ::,,,3,4,5,6,7,8,9 Every digit position has a weight which is a power of Base

### Floating Point Numbers. Question. Learning Outcomes. Number Representation - recap. Do you have your laptop here?

Question Floating Point Numbers 6.626068 x 10-34 Do you have your laptop here? A yes B no C what s a laptop D where is here? E none of the above Eddie Edwards eedwards@doc.ic.ac.uk https://www.doc.ic.ac.uk/~eedwards/compsys

### Binary Numbers. Binary Numbers. Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria

Binary Numbers Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.uni-linz.ac.at http://www.risc.uni-linz.ac.at/people/schreine

### ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g.,

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

Divide: Paper & Pencil Computer Architecture ALU Design : Division and Floating Point 1001 Quotient Divisor 1000 1001010 Dividend 1000 10 101 1010 1000 10 (or Modulo result) See how big a number can be

### Computer Organization and Architecture

Computer Organization and Architecture Chapter 9 Computer Arithmetic Arithmetic & Logic Unit Performs arithmetic and logic operations on data everything that we think of as computing. Everything else in

### Approximation Errors in Computer Arithmetic (Chapters 3 and 4)

Approximation Errors in Computer Arithmetic (Chapters 3 and 4) Outline: Positional notation binary representation of numbers Computer representation of integers Floating point representation IEEE standard

### Restoring division. 2. Run the algorithm Let s do 0111/0010 (7/2) unsigned. 3. Find remainder here. 4. Find quotient here.

Binary division Dividend = divisor q quotient + remainder CS/COE447: Computer Organization and Assembly Language Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) Chapter 3 We

### Floating-point computation

Real values and floating point values Floating-point representation IEEE 754 standard representation rounding special values Floating-point computation 1 Real values Not all values can be represented exactly

### Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Decimal Division Remember 4th grade long division? 43 // quotient 12 521 // divisor dividend -480 41-36 5 // remainder Shift divisor left (multiply by 10) until MSB lines up with dividend s Repeat until

### CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 47 2.2 Positional Numbering Systems 48 2.3 Converting Between Bases 48 2.3.1 Converting Unsigned Whole Numbers 49 2.3.2 Converting Fractions

### FLOATING POINT NUMBERS

FLOATING POINT NUMBERS Introduction Richard Hayden (with thanks to Naranker Dulay) rh@doc.ic.ac.uk http://www.doc.ic.ac.uk/~rh/teaching or https://www.doc.ic.ac.uk/~wl/teachlocal/arch1 or CATE Numbers:

### Introduction to IEEE Standard 754 for Binary Floating-Point Arithmetic

Introduction to IEEE Standard 754 for Binary Floating-Point Arithmetic Computer Organization and Assembly Languages, NTU CSIE, 2004 Speaker: Jiun-Ren Lin Date: Oct 26, 2004 Floating point numbers Integers:

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

This Unit: Floating Point Arithmetic CIS 371 Computer Organization and Design Unit 7: Floating Point App App App System software Mem CPU I/O Formats Precision and range IEEE 754 standard Operations Addition

### Binary Numbers Again. Binary Arithmetic, Subtraction. Binary, Decimal addition

Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N -1. 4 bits = 0 to 15 8 bits = 0 to 255 16 bits = 0 to 65535 Besides simply representation, we would

### After adjusting the expoent value of the smaller number have

1 (a) Provide the hexadecimal representation of a denormalized number in single precision IEEE 754 notation. What is the purpose of denormalized numbers? A denormalized number is a floating point number

### Chapter 4. Computer Arithmetic

Chapter 4 Computer Arithmetic 4.1 Number Systems A number system uses a specific radix (base). Radices that are power of 2 are widely used in digital systems. These radices include binary (base 2), quaternary

### quotient = dividend / divisor, with a remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R)

Binary division quotient = dividend / divisor, with a remainder dividend = divisor quotient + remainder Given dividend and divisor, we want to obtain quotient (Q) and remainder (R) We will start from our

### By the end of the lecture, you should be able to:

Extra Lecture: Number Systems Objectives - To understand: Base of number systems: decimal, binary, octal and hexadecimal Textual information stored as ASCII Binary addition/subtraction, multiplication

### 4 Operations On Data

4 Operations On Data 4.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, students should be able to: List the three categories of operations performed on

### Number Systems and. Data Representation

Number Systems and Data Representation 1 Lecture Outline Number Systems Binary, Octal, Hexadecimal Representation of characters using codes Representation of Numbers Integer, Floating Point, Binary Coded

### Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

ERRORS and COMPUTER ARITHMETIC Types of Error in Numerical Calculations Initial Data Errors: from experiment, modeling, computer representation; problem dependent but need to know at beginning of calculation.

### Lecture 11: Number Systems

Lecture 11: Number Systems Numeric Data Fixed point Integers (12, 345, 20567 etc) Real fractions (23.45, 23., 0.145 etc.) Floating point such as 23. 45 e 12 Basically an exponent representation Any number

### Quiz for Chapter 3 Arithmetic for Computers 3.10

Date: Quiz for Chapter 3 Arithmetic for Computers 3.10 Not all questions are of equal difficulty. Please review the entire quiz first and then budget your time carefully. Name: Course: Solutions in RED

### Digital Fundamentals

Digital Fundamentals with PLD Programming Floyd Chapter 2 29 Pearson Education Decimal Numbers The position of each digit in a weighted number system is assigned a weight based on the base or radix of

### Number Representation and Arithmetic in Various Numeral Systems

1 Number Representation and Arithmetic in Various Numeral Systems Computer Organization and Assembly Language Programming 203.8002 Adapted by Yousef Shajrawi, licensed by Huong Nguyen under the Creative

### ELET 7404 Embedded & Real Time Operating Systems. Fixed-Point Math. Chap. 9, Labrosse Book. Fall 2007

ELET 7404 Embedded & Real Time Operating Systems Fixed-Point Math Chap. 9, Labrosse Book Fall 2007 Fixed-Point Math Most low-end processors, such as embedded processors Do not provide hardware-assisted

### Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD).

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

### CHAPTER 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 ) +(

### Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 INTRODUCTION TO DIGITAL LOGIC

Levent EREN levent.eren@ieu.edu.tr A-306 Office Phone:488-9882 1 Number Systems Representation Positive radix, positional number systems A number with radix r is represented by a string of digits: A n

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

LSN 2 Number Systems Department of Engineering Technology LSN 2 Decimal Number System Decimal number system has 10 digits (0-9) Base 10 weighting system... 10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3

### Radix Number Systems. Number Systems. Number Systems 4/26/2010. basic idea of a radix number system how do we count:

Number Systems binary, octal, and hexadecimal numbers why used conversions, including to/from decimal negative binary numbers floating point numbers character codes basic idea of a radix number system

### Data Storage 3.1. Foundations of Computer Science Cengage Learning

3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

### Data types. lecture 4

Data types lecture 4 Information in digital computers is represented using binary number system. The base, i.e. radix, of the binary system is 2. Other common number systems: octal (base 8), decimal (base

### Recall that in base 10, the digits of a number are just coefficients of powers of the base (10):

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### 1. Number Representation

CSEE 3827: Fundamentals of Computer Systems, Spring 2011 1. Number Representation Prof. Martha Kim (martha@cs.columbia.edu) Web: http://www.cs.columbia.edu/~martha/courses/3827/sp11/ Contents (H&H 1.3-1.4,

### Chapter 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

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

Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

### Bit operations carry* 0110 a 0111 b a+b. 1 and 3 exclusive OR (^) 2 and 4 and (&) 5 or ( )

Bit operations 1 and 3 exclusive OR (^) 2 and 4 and (&) 5 or ( ) 01100 carry* 0110 a 0111 b 01101 a+b * Always start with a carry-in of 0 Did it work? What is a? What is b? What is a+b? What if 8 bits

### Presented By: Ms. Poonam Anand

Presented By: Ms. Poonam Anand Know the different types of numbers Describe positional notation Convert numbers in other bases to base 10 Convert base 10 numbers into numbers of other bases Describe the

### Computer is a binary digital system. Data. Unsigned Integers (cont.) Unsigned Integers. Binary (base two) system: Has two states: 0 and 1

Computer Programming Programming Language Is telling the computer how to do something Wikipedia Definition: Applies specific programming languages to solve specific computational problems with solutions

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### Simulation & Synthesis Using VHDL

Floating Point Multipliers: Simulation & Synthesis Using VHDL By: Raj Kumar Singh - B.E. (Hons.) Electrical & Electronics Shivananda Reddy - B.E. (Hons.) Electrical & Electronics BITS, PILANI Outline Introduction

### Y = abc = a b c.2 0

Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation Other data types Why do Computers use Base 2? Base 10 Number Representation Natural representation for human

### Number Systems & Encoding

Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers

### 1 Basic Computing Concepts (4) Data Representations

1 Basic Computing Concepts (4) Data Representations 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

### Introduction to Telecommunications and Computer Engineering Unit 2: Number Systems and Logic

Introduction to Telecommunications and Computer Engineering Unit 2: Number Systems and Logic Syedur Rahman Lecturer, CSE Department North South University syedur.rahman@wolfson.oon.org Acknowledgements

### Representation of Floating Point Numbers in

Representation of Floating Point Numbers in Single Precision IEEE 754 Standard Value = N = (-1) S X 2 E-127 X (1.M) 0 < E < 255 Actual exponent is: e = E - 127 sign 1 8 23 S E M exponent: excess 127 binary

### Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

### Number Representation

Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

### 2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

2/9/9 Binary number system Computer (electronic) systems prefer binary numbers Binary number: represent a number in base-2 Binary numbers 2 3 + 7 + 5 Some terminology Bit: a binary digit ( or ) Hexadecimal

### MT1 Number Systems. In general, the number a 3 a 2 a 1 a 0 in a base b number system represents the following number:

MT1 Number Systems MT1.1 Introduction A number system is a well defined structured way of representing or expressing numbers as a combination of the elements of a finite set of mathematical symbols (i.e.,

### CSCI 230 Class Notes Binary Number Representations and Arithmetic

CSCI 230 Class otes Binary umber Representations and Arithmetic Mihran Tuceryan with some modifications by Snehasis Mukhopadhyay Jan 22, 1999 1 Decimal otation What does it mean when we write 495? How

### CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,

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

ECE Department Summer LECTURE #5: Number Systems EEL : Digital Logic and Computer Systems Based on lecture notes by Dr. Eric M. Schwartz Decimal Number System: -Our standard number system is base, also

### Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML. By Prashanth Tilleti

Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML By Prashanth Tilleti Advisor Dr. Matthew Fluet Department of Computer Science B. Thomas Golisano

### 1. Convert the following binary exponential expressions to their 'English'

Answers to Practice Problems Practice Problems - Integer Number System Conversions 1. Convert the decimal integer 427 10 into the following number systems: a. 110101011 2 c. 653 8 b. 120211 3 d. 1AB 16

### Floating-Point Numbers. Floating-point number system characterized by four integers: base or radix precision exponent range

Floating-Point Numbers Floating-point number system characterized by four integers: β p [L, U] base or radix precision exponent range Number x represented as where x = ± ( d 0 + d 1 β + d 2 β 2 + + d p

### Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

### Chapter II Binary Data Representation

Chapter II Binary Data Representation The atomic unit of data in computer systems is the bit, which is actually an acronym that stands for BInary digit. It can hold only 2 values or states: 0 or 1, true

### Chap 3 Data Representation

Chap 3 Data Representation 3-11 Data Types How to representation and conversion between these data types? 3-11 Data Types : Number System Radix : Decimal : radix 10 Binary : radix 2 3-11 Data Types : Number

### > 2. Error and Computer Arithmetic

> 2. Error and Computer Arithmetic Numerical analysis is concerned with how to solve a problem numerically, i.e., how to develop a sequence of numerical calculations to get a satisfactory answer. Part

### Chapter 2 Numeric Representation.

Chapter 2 Numeric Representation. Most of the things we encounter in the world around us are analog; they don t just take on one of two values. How then can they be represented digitally? The key is that

### Bits, Data Types, and Operations. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

Bits, Data Types, and Operations University of Texas at Austin CS3H - Computer Organization Spring 2 Don Fussell How do we represent data in a computer? At the lowest level, a computer is an electronic

### Binary Numbering Systems

Binary Numbering Systems April 1997, ver. 1 Application Note 83 Introduction Binary numbering systems are used in virtually all digital systems, including digital signal processing (DSP), networking, and

### Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary

### Binary Representation. Number Systems. Positional Notation

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems

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

Binary Representation The basis of all digital data is binary representation. Binary - means two 1, 0 True, False Hot, Cold On, Off We must be able to handle more than just values for real world problems

### Arithmetic of Number Systems

2 Arithmetic of Number Systems INTRODUCTION Arithmetic operations in number systems are usually done in binary because designing of logic networks is much easier than decimal. In this chapter we will discuss

### Numerical Matrix Analysis

Numerical Matrix Analysis Lecture Notes #10 Conditioning and / Peter Blomgren, blomgren.peter@gmail.com Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research

### Lecture 2. Binary and Hexadecimal Numbers

Lecture 2 Binary and Hexadecimal Numbers Purpose: Review binary and hexadecimal number representations Convert directly from one base to another base Review addition and subtraction in binary representations

### Two s Complement Arithmetic

Two s Complement Arithmetic We now address the issue of representing integers as binary strings in a computer. There are four formats that have been used in the past; only one is of interest to us. The

### 198:211 Computer Architecture

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book 1 Computer Architecture What do computers do? Manipulate stored

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

Binary Numbers In computer science we deal almost exclusively with binary numbers. it will be very helpful to memorize some binary constants and their decimal and English equivalents. By English equivalents

### CSE 1400 Applied Discrete Mathematics Conversions Between Number Systems

CSE 400 Applied Discrete Mathematics Conversions Between Number Systems Department of Computer Sciences College of Engineering Florida Tech Fall 20 Conversion Algorithms: Decimal to Another Base Conversion

### Fixed-Point Arithmetic

Fixed-Point Arithmetic Fixed-Point Notation A K-bit fixed-point number can be interpreted as either: an integer (i.e., 20645) a fractional number (i.e., 0.75) 2 1 Integer Fixed-Point Representation N-bit

### This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Introduction to Embedded Microcomputer Systems Lecture 5.1 2.9. Conversions ASCII to binary n = 100*(Data[0]-0x30) + 10*(Data[1]-0x30) + (Data[2]-0x30); This 3-digit ASCII string could also be calculated

### Verilog Review and Fixed Point Arithmetics. Overview

Verilog Review and Fixed Point Arithmetics CSE4210 Winter 2012 Mokhtar Aboelaze based on slides by Dr. Shoab A. Khan Overview Floating and Fixed Point Arithmetic System Design Flow Requirements and Specifications

### MIPS floating-point arithmetic

MIPS floating-point arithmetic Floating-point computations are vital for many applications, but correct implementation of floating-point hardware and software is very tricky. Today we ll study the IEEE

### CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

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

Exercises 1 - number representations Questions 1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal: (a) 3012 (b) - 435 2. For each of

### CS321. Introduction to Numerical Methods

CS3 Introduction to Numerical Methods Lecture Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506-0633 August 7, 05 Number in

### Fixed-point Mathematics

Appendix A Fixed-point Mathematics In this appendix, we will introduce the notation and operations that we use for fixed-point mathematics. For some platforms, e.g., low-cost mobile phones, fixed-point

### الدكتور المھندس عادل مانع داخل

الدكتور المھندس عادل مانع داخل / میسان جامعة / كلیة الھندسة قسم الھندسة الكھرباي یة Chapter 1: Digital Systems Discrete Data Examples: 26 letters of the alphabet (A, B etc) 10 decimal digits (0, 1, 2 etc)

### CPS311 Lecture: Representing Information in Binary Last revised 8/22/13

CPS311 Lecture: Representing Information in Binary Last revised 8/22/13 Objectives: 1. To review binary representation for unsigned integers 2. To introduce octal and hexadecimal shorthands 3. To review

### NUMBER REPRESENTATIONS IN THE COMPUTER for COSC 120

NUMBER REPRESENTATIONS IN THE COMPUTER for COSC 120 First, a reminder of how we represent base ten numbers. Base ten uses ten (decimal) digits: 0, 1, 2,3, 4, 5, 6, 7, 8, 9. In base ten, 10 means ten. Numbers

### Integer Numbers. The Number Bases of Integers Textbook Chapter 3

Integer Numbers The Number Bases of Integers Textbook Chapter 3 Number Systems Unary, or marks: /////// = 7 /////// + ////// = ///////////// Grouping lead to Roman Numerals: VII + V = VVII = XII Better:

### Computer Representation of Numbers and Computer Arithmetic

Computer Representation of Numbers and Computer Arithmetic c Adrian Sandu, 1998 2007 February 5, 2008 1 Binary numbers In the decimal system, the number 107.625 means 107.625 = 1 10 2 + 7 10 0 + 6 10 1