# ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 ECE 0142 Computer Organization Lecture 3 Floating Point Representations 1

2 Floating-point arithmetic We often incur floating-point programming. Floating point greatly simplifies working with large (e.g., 2 70 ) and small (e.g., 2-17 ) numbers We ll focus on the IEEE 754 standard for floating-point arithmetic. How FP numbers are represented Limitations of FP numbers FP addition and multiplication 2

3 Floating-point representation IEEE numbers are stored using a kind of scientific notation. mantissa * 2 exponent We can represent floating-point numbers with three binary fields: a sign bit s, an exponent field e, and a fraction field f. s e f The IEEE 754 standard defines several different precisions. Single precision numbers include an 8-bit exponent field and a 23-bit fraction, for a total of 32 bits. Double precision numbers have an 11-bit exponent field and a 52-bit fraction, for a total of 64 bits. 3

4 Sign s e f The sign bit is 0 for positive numbers and 1 for negative numbers. But unlike integers, IEEE values are stored in signed magnitude format. 4

5 Mantissa s e f There are many ways to write a number in scientific notation, but there is always a unique normalized representation, with exactly one non-zero digit to the left of the point = = 2.32 * 10 2 = = = The field f contains a binary fraction. The actual mantissa of the floating-point value is (1 + f). In other words, there is an implicit 1 to the left of the binary point. For example, if f is 01101, the mantissa would be A side effect is that we get a little more precision: there are 24 bits in the mantissa, but we only need to store 23 of them. But, what about value 0? 5

6 Exponent s e f There are special cases that require encodings Infinities (overflow) NAN (divide by zero) For example: Single-precision: 8 bits in e 256 codes; reserved for special cases 255 codes; one code for zero 254 codes; need both positive and negative exponents half positives (127), and half negatives (127) Double-precision: 11 bits in e 2048 codes; reserved for special cases 2047 codes; one code for zero 2046 codes; need both positive and negative exponents half positives (1023), and half negatives (1023) 6

7 Exponent s e f The e field represents the exponent as a biased number. It contains the actual exponent plus 127 for single precision, or the actual exponent plus 1023 in double precision. This converts all single-precision exponents from -126 to +127 into unsigned numbers from 1 to 254, and all double-precision exponents from to into unsigned numbers from 1 to Two examples with single-precision numbers are shown below. If the exponent is 4, the e field will be = 131 ( ). If e contains (93 10 ), the actual exponent is = Storing a biased exponent means we can compare IEEE values as if they were signed integers. 7

8 e Meaning Reserved Reserved 8

9 Converting an IEEE 754 number to decimal s e f The decimal value of an IEEE number is given by the formula: (1-2s) * (1 + f) * 2 e-bias Here, the s, f and e fields are assumed to be in decimal. (1-2s) is 1 or -1, depending on whether the sign bit is 0 or 1. We add an implicit 1 to the fraction field f, as mentioned earlier. Again, the bias is either 127 or 1023, for single or double precision. 9

10 Example IEEE-decimal conversion Let s find the decimal value of the following IEEE number First convert each individual field to decimal. The sign bit s is 1. The e field contains = The mantissa is = Then just plug these decimal values of s, e and f into our formula. (1-2s) * (1 + f) * 2 e-bias This gives us (1-2) * ( ) * = (-1.75 * 2-3 ) =

11 Converting a decimal number to IEEE 754 What is the single-precision representation of ? 1. First convert the number to binary: = Normalize the number by shifting the binary point until there is a single 1 to the left: x 2 0 = x The bits to the right of the binary point comprise the fractional field f. 4. The number of times you shifted gives the exponent. The field e should contain: exponent Sign bit: 0 if positive, 1 if negative. 11

12 Recap Exercise What is the single-precision representation of = = s = 0 e = = 136 = f = The single-precision representation is:

13 Special Values (single-precision) E F meaning Notes and X X Valid number Unnormalized =(-1) S x x (0.F) Infinity X X Not a Number 13

14 E Real Exponent F Value Reserved xxx x Unnormalized (-1) S x x (0.F) Normalized (-1) S x 2 e-127 x (1.F) Reserved Infinity xxx x NaN 14

15 Range of numbers Normalized (positive range; negative is symmetric) smallest largest (1+0) = ( ) Unnormalized smallest largest (2-23 ) = ( ) ( ) ( ) Positive underflow Positive overflow 15

16 In comparison The smallest and largest possible 32-bit integers in two s complement are only and How can we represent so many more values in the IEEE 754 format, even though we use the same number of bits as regular integers? what s the next representable FP number? ( ) differ from the smallest number by

17 Finiteness There aren t more IEEE numbers. With 32 bits, there are 2 32, or about 4 billion, different bit patterns. These can represent 4 billion integers or 4 billion reals. But there are an infinite number of reals, and the IEEE format can only represent some of the ones from about to Represent same number of values between 2 n and 2 n+1 as 2 n+1 and 2 n Thus, floating-point arithmetic has issues Small roundoff errors can accumulate with multiplications or exponentiations, resulting in big errors. Rounding errors can invalidate many basic arithmetic principles such as the associative law, (x + y) + z = x + (y + z). The IEEE 754 standard guarantees that all machines will produce the same results but those results may not be mathematically accurate! 17

18 Limits of the IEEE representation Even some integers cannot be represented in the IEEE format. int x = ; float y = ; printf( "%d\n", x ); printf( "%f\n", y ); Some simple decimal numbers cannot be represented exactly in binary to begin with =

19 0.10 During the Gulf War in 1991, a U.S. Patriot missile failed to intercept an Iraqi Scud missile, and 28 Americans were killed. A later study determined that the problem was caused by the inaccuracy of the binary representation of The Patriot incremented a counter once every 0.10 seconds. It multiplied the counter value by 0.10 to compute the actual time. However, the (24-bit) binary representation of 0.10 actually corresponds to , which is off by This doesn t seem like much, but after 100 hours the time ends up being off by 0.34 seconds enough time for a Scud to travel 500 meters! Professor Skeel wrote a short article about this. Roundoff Error and the Patriot Missile. SIAM News, 25(4):11, July

20 Floating-point addition example To get a feel for floating-point operations, we ll do an addition example. To keep it simple, we ll use base 10 scientific notation. Assume the mantissa has four digits, and the exponent has one digit. An example for the addition: = As normalized numbers, the operands would be written as: * *

21 Steps 1-2: the actual addition 1. Equalize the exponents. The operand with the smaller exponent should be rewritten by increasing its exponent and shifting the point leftwards * 10-1 = * 10 1 With four significant digits, this gets rounded to: This can result in a loss of least significant digits the rightmost 1 in this case. But rewriting the number with the larger exponent could result in loss of the most significant digits, which is much worse. 2. Add the mantissas * * *

22 Steps 3-5: representing the result 3. Normalize the result if necessary * 10 1 = * 10 2 This step may cause the point to shift either left or right, and the exponent to either increase or decrease. 4. Round the number if needed * 10 2 gets rounded to * Repeat Step 3 if the result is no longer normalized. We don t need this in our example, but it s possible for rounding to add digits for example, rounding yields Our result is 1.002*10 2, or The correct answer is , so we have the right answer to four significant digits, but there s a small error already. 22

23 Multiplication To multiply two floating-point values, first multiply their magnitudes and add their exponents * 10 1 * * * 10 0 You can then round and normalize the result, yielding * The sign of the product is the exclusive-or of the signs of the operands. If two numbers have the same sign, their product is positive. If two numbers have different signs, the product is negative. 0 0 = = = = 0 This is one of the main advantages of using signed magnitude. 23

24 The history of floating-point computation In the past, each machine had its own implementation of floating-point arithmetic hardware and/or software. It was impossible to write portable programs that would produce the same results on different systems. It wasn t until 1985 that the IEEE 754 standard was adopted. Having a standard at least ensures that all compliant machines will produce the same outputs for the same program. 24

25 Floating-point hardware When floating point was introduced in microprocessors, there wasn t enough transistors on chip to implement it. You had to buy a floating point co-processor (e.g., the Intel 8087) As a result, many ISA s use separate registers for floating point. Modern transistor budgets enable floating point to be on chip. Intel s 486 was the first x86 with built-in floating point (1989) Even the newest ISA s have separate register files for floating point. Makes sense from a floor-planning perspective. 25

26 FPU like co-processor on chip 26

27 Summary The IEEE 754 standard defines number representations and operations for floating-point arithmetic. Having a finite number of bits means we can t represent all possible real numbers, and errors will occur from approximations. 27

28 For recitation 28

29 What if the Unnormalized Rep. is Defined Differently? E F meaning Notes and X X Valid number Unnormalized =(-1) S x x (0.F) Infinity F X X Not a Number 29

30 Range of numbers Normalized (positive range; negative is symmetric) smallest largest (1+0) = ( ) Unnormalized smallest largest (2-23 ) = Need change ( ) ( ) ( ) Positive underflow Positive overflow 30

31 In comparison The smallest and largest possible 32-bit integers in two s complement are only and How can we represent so many more values in the IEEE 754 format, even though we use the same number of bits as regular integers? what s the next representable FP number? ( ) differ from the smallest number by How is this derived? 31

### 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.,

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

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

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

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

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

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

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

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

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

2 Fractional Numbers Fractional Number Notations 2010 - 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### DNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk

DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued

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

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

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

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

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

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

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

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

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

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

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

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

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

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

### Computer arithmetic and round-off errors

Chapter 5 Computer arithmetic and round-off errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers

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

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

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

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

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

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

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

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

### A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

### Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Lecture 12: Floating Point Data Floating Point Representation Numbers too large for standard integer representations or that have fractional components

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

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

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

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

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

### Lecture 5, Representation of Fractions & Floating Point Numbers

Computer Science 210 Computer Systems 1 Lecture Notes Lecture 5, Representation of Fractions & Floating Point Numbers Credits: Adapted from slides prepared by Gregory T. Byrd, North Carolina State University

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

### Number Systems and Number Representation

Number Systems and Number Representation 1 For Your Amusement Question: Why do computer programmers confuse Christmas and Halloween? Answer: Because 25 Dec = 31 Oct -- http://www.electronicsweekly.com

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

### Floating Point Arithmetic. Fractional Binary Numbers. Floating Point. Page 1. Numbers

Floating Point Arithmetic Topics Numbers in general IEEE Floating Point Standard Rounding Floating Point Mathematical properties Puzzles test basic understanding Bizarre FP factoids Numbers Many types

### CHAPTER 5 Round-off errors

CHAPTER 5 Round-off errors In the two previous chapters we have seen how numbers can be represented in the binary numeral system and how this is the basis for representing numbers in computers. Since any

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

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

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

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

### Review 1/2. CS61C Characters and Floating Point. Lecture 8. February 12, Review 2/2 : 12 new instructions Arithmetic:

Review 1/2 CS61C Characters and Floating Point Lecture 8 February 12, 1999 Handling case when number is too big for representation (overflow) Representing negative numbers (2 s complement) Comparing signed

### The wavelength of infrared light is meters. The digits 3 and 7 are important but all the zeros are just place holders.

Section 6 2A: A common use of positive and negative exponents is writing numbers in scientific notation. In astronomy, the distance between 2 objects can be very large and the numbers often contain many

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

### A Library of Parameterized Floating Point Modules and Their Use

A Library of Parameterized Floating Point Modules and Their Use Pavle Belanović and Miriam Leeser Dept of Electrical and Computer Engineering Northeastern University Boston, MA, 02115, USA {pbelanov,mel}@ece.neu.edu

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

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

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

### Representation of Data

Representation of Data In contrast with higher-level programming languages, C does not provide strong abstractions for representing data. Indeed, while languages like Racket has a rich notion of data type

### Arithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:

6 Objectives After completing this lab you will: know how to do integer arithmetic in MIPS know how to do floating point arithmetic in MIPS know about conversion from integer to floating point and from

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

### Decimal Numbers: Base 10 Integer Numbers & Arithmetic

Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number

### Harmonic Sum Calculation: Sneaking Finite Precision Principles into CS1

Harmonic Sum Calculation: Sneaking Finite Precision Principles into CS1 Andrew A. Anda Department of Computer Science St. Cloud State University aanda@eeyore.stcloudstate.edu Abstract We describe using

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

### Integer Numbers. Digital Signal Processor Data Path. Characteristics of Two Complements Representation. Integer Three Bit Representation 000

Integer Numbers Twos Complement Representation Digital Signal Processor Data Path Ingo Sander Ingo@imit.kth.se B=b N-1 b N-2...b 1 b 0 where b i {0,1} b N-1 b N-2... b 1 b 0 Sign Bit Decimal Value D(B)=-b

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

### HOMEWORK # 2 SOLUTIO

HOMEWORK # 2 SOLUTIO Problem 1 (2 points) a. There are 313 characters in the Tamil language. If every character is to be encoded into a unique bit pattern, what is the minimum number of bits required to

### CALCULATOR AND COMPUTER ARITHMETIC

MathScope Handbook - Calc/Comp Arithmetic Page 1 of 7 Click here to return to the index 1 Introduction CALCULATOR AND COMPUTER ARITHMETIC Most of the computational work you will do as an Engineering Student

### Decimal Floating-Point: Algorism for Computers

Decimal Floating-Point: Algorism for Computers Arith16 16 June 2003 Mike Cowlishaw IBM Fellow http://www2.hursley.ibm.com/decimal decarith16 Overview Why decimal arithmetic is increasingly important Why

### Fixed-Point Arithmetic in Impulse C

Application Note Fixed-Point Arithmetic in Impulse C Ralph Bodenner, Senior Applications Engineer Impulse Accelerated Technologies, Inc. Copyright 2005 Impulse Accelerated Technologies, Inc. Overview This

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

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

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

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

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

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

### IEEE FLOATING-POINT ARITHMETIC IN AMD'S GRAPHICS CORE NEXT ARCHITECTURE MIKE SCHULTE AMD RESEARCH JULY 2016

IEEE 754-2008 FLOATING-POINT ARITHMETIC IN AMD'S GRAPHICS CORE NEXT ARCHITECTURE MIKE SCHULTE AMD RESEARCH JULY 2016 AGENDA AMD s Graphics Core Next (GCN) Architecture Processors Featuring the GCN Architecture

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

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

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

### Computer Systems Architecture

Computer Systems Architecture http://cs.nott.ac.uk/ txa/g51csa/ Thorsten Altenkirch and Liyang Hu School of Computer Science University of Nottingham Lecture 09: Floating Point Arithmetic and the MIPS