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

Size: px
Start display at page:

Download "Fractional Numbers. Fractional Number Notations. Fixed-point Notation. Fixed-point Notation"

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

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

More information

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

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

More information

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

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

More information

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

More information

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

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

More information

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

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.

More information

Lecture 11: Number Systems

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

More information

Data Storage 3.1. Foundations of Computer Science Cengage Learning

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

More information

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

More information

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

More information

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

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

More information

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

More information

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

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

More information

Computer Science 281 Binary and Hexadecimal Review

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

More information

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

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

More information

Number Representation

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

More information

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

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

More information

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

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

More information

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

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

More information

Numerical Matrix Analysis

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

More information

CS321. Introduction to Numerical Methods

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

More information

Binary Numbering Systems

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

More information

Lecture 2. Binary and Hexadecimal Numbers

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

More information

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

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

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

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

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

More information

Solution for Homework 2

Solution for Homework 2 Solution for Homework 2 Problem 1 a. What is the minimum number of bits that are required to uniquely represent the characters of English alphabet? (Consider upper case characters alone) The number of

More information

Useful Number Systems

Useful Number Systems Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

More information

Binary Representation

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

More information

Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved.

Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved. Attention: This material is copyright 1995-1997 Chris Hecker. All rights reserved. You have permission to read this article for your own education. You do not have permission to put it on your website

More information

What Every Computer Scientist Should Know About Floating-Point Arithmetic

What Every Computer Scientist Should Know About Floating-Point Arithmetic What Every Computer Scientist Should Know About Floating-Point Arithmetic D Note This document is an edited reprint of the paper What Every Computer Scientist Should Know About Floating-Point Arithmetic,

More information

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

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

More information

CHAPTER 5 Round-off errors

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

More information

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012 Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3? Data Representation (1/2) Each numbering

More information

CSI 333 Lecture 1 Number Systems

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

More information

ASCII Characters. 146 CHAPTER 3 Information Representation. The sign bit is 1, so the number is negative. Converting to decimal gives

ASCII Characters. 146 CHAPTER 3 Information Representation. The sign bit is 1, so the number is negative. Converting to decimal gives 146 CHAPTER 3 Information Representation The sign bit is 1, so the number is negative. Converting to decimal gives 37A (hex) = 134 (dec) Notice that the hexadecimal number is not written with a negative

More information

Q-Format number representation. Lecture 5 Fixed Point vs Floating Point. How to store Q30 number to 16-bit memory? Q-format notation.

Q-Format number representation. Lecture 5 Fixed Point vs Floating Point. How to store Q30 number to 16-bit memory? Q-format notation. Lecture 5 Fixed Point vs Floating Point Objectives: Understand fixed point representations Understand scaling, overflow and rounding in fixed point Understand Q-format Understand TM32C67xx floating point

More information

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

plc numbers - 13.1 Encoded values; BCD and ASCII Error detection; parity, gray code and checksums plc numbers - 3. Topics: Number bases; binary, octal, decimal, hexadecimal Binary calculations; s compliments, addition, subtraction and Boolean operations Encoded values; BCD and ASCII Error detection;

More information

Floating point package user s guide By David Bishop (dbishop@vhdl.org)

Floating point package user s guide By David Bishop (dbishop@vhdl.org) Floating point package user s guide By David Bishop (dbishop@vhdl.org) Floating-point numbers are the favorites of software people, and the least favorite of hardware people. The reason for this is because

More information

THE EXACT DOT PRODUCT AS BASIC TOOL FOR LONG INTERVAL ARITHMETIC

THE EXACT DOT PRODUCT AS BASIC TOOL FOR LONG INTERVAL ARITHMETIC THE EXACT DOT PRODUCT AS BASIC TOOL FOR LONG INTERVAL ARITHMETIC ULRICH KULISCH AND VAN SNYDER Abstract. Computing with guarantees is based on two arithmetical features. One is fixed (double) precision

More information

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer Computers CMPT 125: Lecture 1: Understanding the Computer Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 A computer performs 2 basic functions: 1.

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 2: Number Systems and Arithmetic Number Systems - Base The number system that we use is base : 734 = + 7 + 3 + 4 = x + 7x + 3x + 4x = x 3 + 7x

More information

Numbering Systems. InThisAppendix...

Numbering Systems. InThisAppendix... G InThisAppendix... Introduction Binary Numbering System Hexadecimal Numbering System Octal Numbering System Binary Coded Decimal (BCD) Numbering System Real (Floating Point) Numbering System BCD/Binary/Decimal/Hex/Octal

More information

NUMBER SYSTEMS. 1.1 Introduction

NUMBER SYSTEMS. 1.1 Introduction NUMBER SYSTEMS 1.1 Introduction There are several number systems which we normally use, such as decimal, binary, octal, hexadecimal, etc. Amongst them we are most familiar with the decimal number system.

More information

Numerical Analysis I

Numerical Analysis I Numerical Analysis I M.R. O Donohoe References: S.D. Conte & C. de Boor, Elementary Numerical Analysis: An Algorithmic Approach, Third edition, 1981. McGraw-Hill. L.F. Shampine, R.C. Allen, Jr & S. Pruess,

More information

Binary Adders: Half Adders and Full Adders

Binary Adders: Half Adders and Full Adders Binary Adders: Half Adders and Full Adders In this set of slides, we present the two basic types of adders: 1. Half adders, and 2. Full adders. Each type of adder functions to add two binary bits. In order

More information

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

EE 261 Introduction to Logic Circuits. Module #2 Number Systems EE 261 Introduction to Logic Circuits Module #2 Number Systems Topics A. Number System Formation B. Base Conversions C. Binary Arithmetic D. Signed Numbers E. Signed Arithmetic F. Binary Codes Textbook

More information

A Short Guide to Significant Figures

A Short Guide to Significant Figures A Short Guide to Significant Figures Quick Reference Section Here are the basic rules for significant figures - read the full text of this guide to gain a complete understanding of what these rules really

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS. William Stallings NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

More information

Floating Point Fused Add-Subtract and Fused Dot-Product Units

Floating Point Fused Add-Subtract and Fused Dot-Product Units Floating Point Fused Add-Subtract and Fused Dot-Product Units S. Kishor [1], S. P. Prakash [2] PG Scholar (VLSI DESIGN), Department of ECE Bannari Amman Institute of Technology, Sathyamangalam, Tamil Nadu,

More information

3. Convert a number from one number system to another

3. Convert a number from one number system to another 3. Convert a number from one number system to another Conversion between number bases: Hexa (16) Decimal (10) Binary (2) Octal (8) More Interest Way we need conversion? We need decimal system for real

More information

26 Integers: Multiplication, Division, and Order

26 Integers: Multiplication, Division, and Order 26 Integers: Multiplication, Division, and Order Integer multiplication and division are extensions of whole number multiplication and division. In multiplying and dividing integers, the one new issue

More information

Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Goals. Unary Numbers. Decimal Numbers. 3,148 is. 1000 s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1 Number Bases //9 Goals Numbers Understand binary and hexadecimal numbers Be able to convert between number bases Understand binary fractions COMP37 Introduction to Computer Architecture Unary Numbers Decimal

More information

Precision & Performance: Floating Point and IEEE 754 Compliance for NVIDIA GPUs

Precision & Performance: Floating Point and IEEE 754 Compliance for NVIDIA GPUs Precision & Performance: Floating Point and IEEE 754 Compliance for NVIDIA GPUs Nathan Whitehead Alex Fit-Florea ABSTRACT A number of issues related to floating point accuracy and compliance are a frequent

More information

1 Description of The Simpletron

1 Description of The Simpletron Simulating The Simpletron Computer 50 points 1 Description of The Simpletron In this assignment you will write a program to simulate a fictional computer that we will call the Simpletron. As its name implies

More information

CPEN 214 - Digital Logic Design Binary Systems

CPEN 214 - Digital Logic Design Binary Systems CPEN 4 - Digital Logic Design Binary Systems C. Gerousis Digital Design 3 rd Ed., Mano Prentice Hall Digital vs. Analog An analog system has continuous range of values A mercury thermometer Vinyl records

More information

Paramedic Program Pre-Admission Mathematics Test Study Guide

Paramedic Program Pre-Admission Mathematics Test Study Guide Paramedic Program Pre-Admission Mathematics Test Study Guide 05/13 1 Table of Contents Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 Page 9 Page 10 Page 11 Page 12 Page 13 Page 14 Page 15 Page

More information

2011, The McGraw-Hill Companies, Inc. Chapter 3

2011, The McGraw-Hill Companies, Inc. Chapter 3 Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

More information

Negative Integer Exponents

Negative Integer Exponents 7.7 Negative Integer Exponents 7.7 OBJECTIVES. Define the zero exponent 2. Use the definition of a negative exponent to simplify an expression 3. Use the properties of exponents to simplify expressions

More information

Fast Arithmetic Coding (FastAC) Implementations

Fast Arithmetic Coding (FastAC) Implementations Fast Arithmetic Coding (FastAC) Implementations Amir Said 1 Introduction This document describes our fast implementations of arithmetic coding, which achieve optimal compression and higher throughput by

More information

Figure 1. A typical Laboratory Thermometer graduated in C.

Figure 1. A typical Laboratory Thermometer graduated in C. SIGNIFICANT FIGURES, EXPONENTS, AND SCIENTIFIC NOTATION 2004, 1990 by David A. Katz. All rights reserved. Permission for classroom use as long as the original copyright is included. 1. SIGNIFICANT FIGURES

More information

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

More information

This section describes how LabVIEW stores data in memory for controls, indicators, wires, and other objects.

This section describes how LabVIEW stores data in memory for controls, indicators, wires, and other objects. Application Note 154 LabVIEW Data Storage Introduction This Application Note describes the formats in which you can save data. This information is most useful to advanced users, such as those using shared

More information

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1

More information

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15

Addition Methods. Methods Jottings Expanded Compact Examples 8 + 7 = 15 Addition Methods Methods Jottings Expanded Compact Examples 8 + 7 = 15 48 + 36 = 84 or: Write the numbers in columns. Adding the tens first: 47 + 76 110 13 123 Adding the units first: 47 + 76 13 110 123

More information

Chapter 2. Binary Values and Number Systems

Chapter 2. Binary Values and Number Systems Chapter 2 Binary Values and Number Systems Numbers Natural numbers, a.k.a. positive integers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative numbers A

More information

THE BINARY NUMBER SYSTEM

THE BINARY NUMBER SYSTEM THE BINARY NUMBER SYSTEM Dr. Robert P. Webber, Longwood University Our civilization uses the base 10 or decimal place value system. Each digit in a number represents a power of 10. For example, 365.42

More information

Fast Logarithms on a Floating-Point Device

Fast Logarithms on a Floating-Point Device TMS320 DSP DESIGNER S NOTEBOOK Fast Logarithms on a Floating-Point Device APPLICATION BRIEF: SPRA218 Keith Larson Digital Signal Processing Products Semiconductor Group Texas Instruments March 1993 IMPORTANT

More information

Binary Numbers. Binary Octal Hexadecimal

Binary Numbers. Binary Octal Hexadecimal Binary Numbers Binary Octal Hexadecimal Binary Numbers COUNTING SYSTEMS UNLIMITED... Since you have been using the 10 different digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 all your life, you may wonder how

More information

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi) INTRODUCTION System- A number system defines a set of values to represent quantity. We talk about the number of people

More information

Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK

Monday January 19th 2015 Title: Transmathematics - a survey of recent results on division by zero Facilitator: TheNumberNullity / James Anderson, UK Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK It has been my pleasure to give two presentations

More information

FAST INVERSE SQUARE ROOT

FAST INVERSE SQUARE ROOT FAST INVERSE SQUARE ROOT CHRIS LOMONT Abstract. Computing reciprocal square roots is necessary in many applications, such as vector normalization in video games. Often, some loss of precision is acceptable

More information

Arithmetic Coding: Introduction

Arithmetic Coding: Introduction Data Compression Arithmetic coding Arithmetic Coding: Introduction Allows using fractional parts of bits!! Used in PPM, JPEG/MPEG (as option), Bzip More time costly than Huffman, but integer implementation

More information

A Step towards an Easy Interconversion of Various Number Systems

A Step towards an Easy Interconversion of Various Number Systems A towards an Easy Interconversion of Various Number Systems Shahid Latif, Rahat Ullah, Hamid Jan Department of Computer Science and Information Technology Sarhad University of Science and Information Technology

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

Lies My Calculator and Computer Told Me

Lies My Calculator and Computer Told Me Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing

More information

Floating-point control in the Intel compiler and libraries or Why doesn t my application always give the expected answer?

Floating-point control in the Intel compiler and libraries or Why doesn t my application always give the expected answer? Floating-point control in the Intel compiler and libraries or Why doesn t my application always give the expected answer? Software Solutions Group Intel Corporation 2012 *Other brands and names are the

More information

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10

6 3 4 9 = 6 10 + 3 10 + 4 10 + 9 10 Lesson The Binary Number System. Why Binary? The number system that you are familiar with, that you use every day, is the decimal number system, also commonly referred to as the base- system. When you

More information

RN-Codings: New Insights and Some Applications

RN-Codings: New Insights and Some Applications RN-Codings: New Insights and Some Applications Abstract During any composite computation there is a constant need for rounding intermediate results before they can participate in further processing. Recently

More information

1. Introductory Overview

1. Introductory Overview Chapter 1 1. Introductory Overview The main goal of this chapter is to review fundamental aspects of analogue and digital signals and systems, digital codes, the binary, decimal and hexadecimal numbering

More information

Some Functions Computable with a Fused-mac

Some Functions Computable with a Fused-mac Some Functions Computable with a Fused-mac Sylvie Boldo and Jean-Michel Muller Laboratoire LIP (CNRS/ENS Lyon/Inria/Univ. lyon ), Projet Arénaire, 46 allée d Italie, 69364 Lyon Cedex 07, FRANCE Sylvie.Boldo@ens-lyon.fr,

More information

The BBP Algorithm for Pi

The BBP Algorithm for Pi The BBP Algorithm for Pi David H. Bailey September 17, 2006 1. Introduction The Bailey-Borwein-Plouffe (BBP) algorithm for π is based on the BBP formula for π, which was discovered in 1995 and published

More information

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın Digital Design Assoc. Prof. Dr. Berna Örs Yalçın Istanbul Technical University Faculty of Electrical and Electronics Engineering Office Number: 2318 E-mail: siddika.ors@itu.edu.tr Grading 1st Midterm -

More information

Decimal form. Fw.d Exponential form Ew.d Ew.dEe Scientific form ESw.d ESw.dEe Engineering form ENw.d ENw.dEe Lw. Horizontal

Decimal form. Fw.d Exponential form Ew.d Ew.dEe Scientific form ESw.d ESw.dEe Engineering form ENw.d ENw.dEe Lw. Horizontal Fortran Formats The tedious part of using Fortran format is to master many format edit descriptors. Each edit descriptor tells the system how to handle certain type of values or activity. Each value requires

More information

.NET Standard DateTime Format Strings

.NET Standard DateTime Format Strings .NET Standard DateTime Format Strings Specifier Name Description d Short date pattern Represents a custom DateTime format string defined by the current ShortDatePattern property. D Long date pattern Represents

More information

Number Systems and Radix Conversion

Number Systems and Radix Conversion Number Systems and Radix Conversion Sanjay Rajopadhye, Colorado State University 1 Introduction These notes for CS 270 describe polynomial number systems. The material is not in the textbook, but will

More information

A White Paper about. MiniSEED for LISS and data compression using Steim1 and Steim2

A White Paper about. MiniSEED for LISS and data compression using Steim1 and Steim2 Contents Norwegian National Seismic Network Technical Report No. 20 A White Paper about MiniSEED for LISS and data compression using Steim1 and Steim2 version 01.00 Prepared by Mauro Mariotti SARA snc

More information

High-Precision C++ Arithmetic

High-Precision C++ Arithmetic Base One International Corporation 44 East 12th Street New York, NY 10003 212-673-2544 info@boic.com www.boic.com High-Precision C++ Arithmetic - Base One s Number Class fixes the loopholes in C++ high-precision

More information

Chapter 5. Binary, octal and hexadecimal numbers

Chapter 5. Binary, octal and hexadecimal numbers Chapter 5. Binary, octal and hexadecimal numbers A place to look for some of this material is the Wikipedia page http://en.wikipedia.org/wiki/binary_numeral_system#counting_in_binary Another place that

More information

Number and codes in digital systems

Number and codes in digital systems Number and codes in digital systems Decimal Numbers You are familiar with the decimal number system because you use them everyday. But their weighted structure is not understood. In the decimal number

More information

Chapter 1. Binary, octal and hexadecimal numbers

Chapter 1. Binary, octal and hexadecimal numbers Chapter 1. Binary, octal and hexadecimal numbers This material is covered in the books: Nelson Magor Cooke et al, Basic mathematics for electronics (7th edition), Glencoe, Lake Forest, Ill., 1992. [Hamilton

More information

23. RATIONAL EXPONENTS

23. RATIONAL EXPONENTS 23. RATIONAL EXPONENTS renaming radicals rational numbers writing radicals with rational exponents When serious work needs to be done with radicals, they are usually changed to a name that uses exponents,

More information

Introduction to Xilinx System Generator Part II. Evan Everett and Michael Wu ELEC 433 - Spring 2013

Introduction to Xilinx System Generator Part II. Evan Everett and Michael Wu ELEC 433 - Spring 2013 Introduction to Xilinx System Generator Part II Evan Everett and Michael Wu ELEC 433 - Spring 2013 Outline Introduction to FPGAs and Xilinx System Generator System Generator basics Fixed point data representation

More information

Chapter 1: Digital Systems and Binary Numbers

Chapter 1: Digital Systems and Binary Numbers Chapter 1: Digital Systems and Binary Numbers Digital age and information age Digital computers general purposes many scientific, industrial and commercial applications Digital systems telephone switching

More information

Chapter 3. if 2 a i then location: = i. Page 40

Chapter 3. if 2 a i then location: = i. Page 40 Chapter 3 1. Describe an algorithm that takes a list of n integers a 1,a 2,,a n and finds the number of integers each greater than five in the list. Ans: procedure greaterthanfive(a 1,,a n : integers)

More information

A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC. E. C. R. HEHNER and R. N. S. HORSPOOL

A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC. E. C. R. HEHNER and R. N. S. HORSPOOL A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC E. C. R. HEHNER and R. N. S. HORSPOOL Abstract. A novel system for representing the rational numbers based on Hensel's p-adic arithmetic

More information

Programming languages C

Programming languages C INTERNATIONAL STANDARD ISO/IEC 9899:1999 TECHNICAL CORRIGENDUM 2 Published 2004-11-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE

More information

FLOATING-POINT ARITHMETIC IN AMD PROCESSORS MICHAEL SCHULTE AMD RESEARCH JUNE 2015

FLOATING-POINT ARITHMETIC IN AMD PROCESSORS MICHAEL SCHULTE AMD RESEARCH JUNE 2015 FLOATING-POINT ARITHMETIC IN AMD PROCESSORS MICHAEL SCHULTE AMD RESEARCH JUNE 2015 AGENDA The Kaveri Accelerated Processing Unit (APU) The Graphics Core Next Architecture and its Floating-Point Arithmetic

More information