CREATING FLOATING POINT VALUES IN MIL-STD-1750A 32 AND 48 BIT FORMATS: ISSUES AND ALGORITHMS

Size: px
Start display at page:

Download "CREATING FLOATING POINT VALUES IN MIL-STD-1750A 32 AND 48 BIT FORMATS: ISSUES AND ALGORITHMS"

Transcription

1 CREATING FLOATING POINT VALUES IN MIL-STD-1750A 32 AND 48 BIT FORMATS: ISSUES AND ALGORITHMS Jeffrey B. Mitchell L3 Communications, Telemetry & Instrumentation Division Storm Control Systems ABSTRACT Experimentation with various routines that create floating point values in MIL-STD- 1750A 32 and 48 bit formats has uncovered several flaws that result in loss of precision in approximation and/or incorrect results. This paper will discuss approximation and key computational conditions in the creation of values in these formats, and will describe algorithms that create values correctly and to the closest possible approximation. Test cases for determining behavior of routines of this type will also be supplied. KEY WORDS MIL-STD-1750A, Floating Point Values, Conversion, Algorithms, Approximation INTRODUCTION Many space vehicles' processors are based on MIL-STD-1750A architecture, while the ground control systems which drive them often are not. A key component of these ground control systems, therefore, is a set of algorithms to create values in MIL-STD-1750A format. Creation of 32 and 48 bit floating point values in this format is the subject of this paper. In order to correctly create floating point numbers in this format, a thorough understanding of certain topics is required. These topics include: the MIL-STD-1750A definition for floating point values, the need for approximation, truncation, rounding, and limits handling. Because MIL-STD-1750A floating point values are represented by the combination of a fractional mantissa and an integral exponent, a basic understanding of this form of numeric representation and its associated computations is also required.

2 NOMENCLATURE Throughout this paper, certain terms and conventions will be used in the text and in equations. The definitions of these terms and conventions are as follows: o 1750A: shorthand for MIL-STD-1750A o m: mantissa o e: exponent o i: integer o f: floating point number o ^: signifies the operation of raising to a power o *: signifies multiplication o ~: denotes equivalence Parentheses will be used to show the order of numeric operations, the innermost operations to be performed first. MIL-STD-1750A FLOATING POINT VALUE DEFINITION A 1750A floating point value consists of a mantissa and an exponent. The value represented is the product of the mantissa multiplied by (the value 2 raised to the power of the exponent), as shown in the following equation: f = m * (2^e) The mantissa is a fraction in the following range: -1.0 <= m < -0.5 or 0.5 <= m < 1.0 The exponent is an integer in the following range: -128 <= e <= 127. A special case of mantissa and exponent both equal to zero is also allowed. In 32 bit 1750A format, the leftmost bit is the mantissa sign bit, the next 23 bits hold the mantissa, and the last 8 bits hold the exponent, as shown in the following table: sign mantissa - most significant exponent bit 0 bits 1-23 bits 24-31

3 In 48 bit 1750A format, the leftmost bit is the mantissa sign bit, the next 23 bits hold the most significant portion of the mantissa, the next 8 bits hold the exponent, and the remaining 16 bits hold the least significant portion of the mantissa, as shown in the following table: sign mantissa - most significant exponent mantissa - least significant bit 0 bits 1-23 bits bits Floating point values are normalized, such that the mantissa sign bit and the next bit must be of opposite value, except in the special case of 0.0. APPROXIMATION Representation of a floating point value in 32 or 48 bit 1750A format often requires approximation due to the fact that there are a finite number of floating point values that correlate directly to values representable in a 1750A mantissa bit pattern, but there are an infinite number of floating point values that may need to be represented. If a value to be represented would reduce to a mantissa that is not directly representable in a 1750A mantissa bit pattern, then the bit pattern directly above or directly below the actual mantissa value must be used. To arrive at one of these choices, one of two methods can be used: truncation or rounding. Truncation results in choosing the mantissa bit pattern directly below the actual mantissa value, regardless of whether the value is closer to the mantissa bit pattern below it or to the one above it. Consequently truncation will not result in the closest possible approximation when the value to be represented is closer to the mantissa bit pattern directly above it. Rounding results in choosing either the mantissa bit pattern directly above or the one directly below the actual mantissa value, depending on which one is closer, (values at the midpoint between the two are rounded up). This results in the closest possible approximation in all cases. The rounding approach will be described in this paper. CALCULATING MANTISSA AND EXPONENT VALUES Given a floating point number, the first step in creating the 1750A representation is to compute the mantissa and the exponent. To do this, the floating point value is repeatedly divided by (2^e), the exponent beginning at zero and being incremented or decremented by one, until either the quotient is in the valid mantissa range or the exponent exceeds the valid exponent range. If the exponent exceeds the range, then the value cannot be represented in 1750A format.

4 The direction in which to move the exponent is determined by the following: if the original floating point value is either greater than the highest valid positive 1750A mantissa value or less than the lowest valid negative 1750A mantissa value, then the exponent is incremented; if the original floating point value is between the highest valid negative 1750A mantissa value and 0, or between 0 and the lowest valid positive 1750A mantissa value, then the exponent is decremented. Of course, if the original floating point value is already within the valid mantissa range, then the mantissa is set to the floating point value and the exponent is set to zero. Also, if the original floating point value is zero, then the mantissa and exponent are both set to zero. Two limit conditions that may be encountered in these initial calculations are for the mantissa and for the exponent. Although these limit checks are straightforward some 1750A conversion routines do not detect them properly. (See items number 1 and 2 in the Appendix for test cases). The next step applies only to negative mantissa values. If the mantissa is negative then it must be adjusted to a positive value in order to calculate the mantissa bit pattern. This is accomplished by adding 1.0 to the negative mantissa value. Also, the fact that the mantissa was originally negative must be remembered for later processing. At this point, the previously negative mantissa will now be a positive value in the following range: 0.0 <= m < 0.5 And remember the range for an originally positive mantissa: 0.5 <= m < 1.0 CREATING THE MANTISSA BIT PATTERN Since both the 32 and the 48 bit 1750A formats have a 23 bit area in which to map the mantissa, the first step is to create the bit pattern in this area. In 23 bits, the available positive (integral) values are in the following range: 0 <= i < (2^23)

5 The range of the mantissa value calculated in the previous section is: 0.0 <= m < 1.0 The first computation to perform is to multiply the mantissa value by (2^23). This will result in a floating point number in the following range: 0.0 <= f < (2^23) If the resulting floating point number does not contain a fractional part, then the number can be directly represented in the 23 bit area. If it does contain a fractional part then approximation is required, and the next step depends on whether a 32 or a 48 bit 1750A format is being created. In the case of the 32 bit format, there is only the single 23 bit area in which to represent the mantissa; therefore rounding is performed to determine whether the previous or the next integral value is closer to the value being represented. This integral value is then mapped into the 23 bit area. For the 48 bit format, in addition to the 23 bit area there is an extra 16 bit area in which to represent the mantissa. The integral portion of the result of the multiplication of the mantissa value by (2^23) is mapped directly into the 23 bit area. The fractional portion of the result needs to be mapped into the 16 bit portion. For this, an additional computation similar to the computation for mapping the initial value into 23 bits is required. In 16 bits, the available positive (integral) values are in the following range: 0 <= i < (2^16) The range of the fraction to be mapped is: 0.0 <= f < 1.0 Therefore the fraction is multiplied by (2^16), resulting in a floating point number in the following range: 0.0 <= f < (2^16) If the resulting floating point number does not contain a fractional part, then the number can be directly represented in the 16 bit area. If it does contain a fractional part, then approximation is required. Since this is the final area in which to represent the mantissa, rounding is performed on this value to determine whether the previous or the next

6 integral value is closer to the value being represented. This integral value is then mapped into the 16 bit area. MANTISSA ROUNDING AND LIMITS PROCESSING - 32 BIT FORMAT In the case of the 32 bit format, rounding was necessary to map the mantissa value into the 23 bit area if multiplying the mantissa value by (2^23) resulted in a product with a fractional part. There are two limit conditions that must be checked in this case: the upper limit for an originally negative mantissa value and the upper limit for an originally positive mantissa value. Recall that an originally negative mantissa was added to 1.0 to arrive at a value in the following range: 0.0 <= m < 0.5 while the range of an originally positive mantissa value was: 0.5 <= m < 1.0 Mapping these to available values in 23 bits yields a range of: 0 <= m < (2^22) for an originally negative mantissa value, and a range of: (2^22) <= m < (2^23) for an originally positive mantissa value. Since these ranges are inclusive on the lower end but exclusive on the upper end, if the rounding results in the value (2^22) for an originally negative mantissa value or the value (2^23) for an originally positive mantissa value, then the upper limit has been exceeded. The action to take in these cases consists of determining an equivalent mantissa/exponent combination where the mantissa is within the valid range. For an originally negative mantissa value, instead of (2^22) a value of 0 is used in the 23 bit mantissa portion and the exponent is decremented by one. This works because (2^22) is the 23 bit representation of 0.5, which is invalid for an originally negative mantissa, but 0 is the 23 bit representation of 0.0, which is valid. The originally negative mantissa was added to 1.0 to arrive at the value to map into 23 bits, so this adjustment actually means

7 that the mantissa value is being changed from -0.5 to Performing this adjustment and decrementing the exponent produces an equivalent value because the following two equations are equivalent: ( -0.5 * (2^i) ) ~ ( -1.0 * (2^(i-1)) ) For an originally positive mantissa value, instead of (2^23) a value of (2^22) is used in the 23 bit mantissa portion and the exponent is incremented by one. This works because (2^23) is the 23 bit representation of 1.0, which is invalid for an originally positive mantissa value, but (2^22) is the 23 bit representation of 0.5, which is valid. Performing this adjustment and incrementing the exponent results in an equivalent value because the following two equations are equivalent: ( 1.0 * (2^i) ) ~ ( 0.5 * (2^(i+1)) ) After incrementing or decrementing the exponent its limits must be rechecked. If exceeded, then the value cannot be represented in the desired 1750A format. See item number 3 in the Appendix for a test case to check this condition. MANTISSA ROUNDING AND LIMITS PROCESSING - 48 BIT FORMAT In the case of the 48 bit format, rounding was necessary to map the fractional part into the 16 bit area if multiplying the mantissa value by (2^23) resulted in a product with a fractional part and multiplying that fractional part by (2^16) also resulted in a product with a fractional part. There is one limit condition that needs to be checked in this case, but handling a limit exceeded condition in this case requires the limit checks described in the previous section to be performed as well. The fraction to be represented in the 16 bit portion is in the following range: 0.0 <= f < 1.0 Mapping this to available values in 16 bits yields a range of: 0.0 <= f < (2^16) Since this range is inclusive on the lower end but exclusive on the upper end, if the rounding results in a value of (2^16) then the upper limit has been exceeded.

8 The action to take in this case consists of setting the 16 bit portion to 0 and incrementing the 23 bit portion by 1. This works because (2^16) is the 16 bit representation of 1.0, and this value is the fractional part of the value being represented in the 23 bit portion. After incrementing the 23 bit portion, the 32 bit format limit checks and handling described in the previous section must also be performed. See item number 4 in the Appendix for a test case to check this condition. COMPLETING THE CONVERSION The final steps in creating the 1750A formatted value are to represent the exponent and to turn on the mantissa sign bit if necessary. The exponent bit pattern is simply the ASCII 8 bit signed character representation of the exponent value. The mantissa sign bit is turned on if the originally calculated mantissa was a negative value. CONCLUSION Utilization of the algorithms described in this paper results in the correct calculation of 1750A 32 and 48 bit formatted floating point values to the closest possible approximation. Several other conversion algorithms currently in use do not achieve this goal primarily due to improper handling of the limit conditions described here. It is hoped that the ground control systems software development community will benefit from this information. ANSI C code that implements the algorithms described in this paper is available for use under the terms of the GNU General Public License. It can be downloaded from the Storm Control Systems FTP site, ftp://ftp.storm.com/pub/archive. APPENDIX - ROUNDING AND LIMITS HANDLING TEST CASES In the following cases 1750A formatted outputs are shown in hexadecimal. 1. Mantissa Limits Handling A 1750A mantissa must be in the following range: -1.0 <= m < -0.5 or 0.5 <= m < 1.0 Some conversion routines improperly allow a mantissa of -0.5 or 1.0. The following example can be used to check for this error:

9 Input: -0.5 Correct 32 bit representation: FF Correct 48 bit representation: FF Incorrect 32 bit representation: C Incorrect 48 bit representation: C Exponent Limits Handling A 1750A exponent must be in the following range: -128 <= e <= 127 Some conversion routines do not check for underflow or overflow conditions. The following example can be used to check for this error: Input: (2^127) Correct 32 and 48 bit 1750A condition: exponent overflow Incorrect 32 bit representation: Incorrect 48 bit representation: bit mantissa portion rounding, limit detection and handling Rounding the 23 bit mantissa portion in the case of a 32 bit 1750A representation results in the closest possible approximation of the value to be represented, but also necessitates checking and handling limit conditions. The approach described in this paper utilizes rounding; but some conversion routines utilize truncation instead, which does not result in the closest possible approximation in cases where rounding up would have occurred. The following example can be used to check for whether 23 bit mantissa portion rounding occurs, and if it does whether the rounding limit conditions are checked and handled properly: Input: Correct rounding, limit condition checks and handling: Rounding attempted, non-detection/handling of limit conditions: No rounding attempted, truncation used instead: 7F FF FF bit mantissa portion rounding, limit detection and handling Rounding the 16 bit mantissa portion in the case of a 48 bit 1750A representation results in the closest possible approximation of the value to be represented, but also necessitates checking and handling a limit condition. The approach described in this paper utilizes rounding; but some conversion routines utilize truncation instead, which does not result

10 in the closest possible approximation in cases where rounding up would have occurred. The following example can be used to check for whether 16 bit mantissa portion rounding occurs, and if it does whether the rounding limit condition is checked and handled properly: Input: Correct rounding, limit condition checking and handling: Rounding attempted, non-detection/handling of limits condition: No rounding attempted, truncation used instead: FF FF

Number Systems. Both numbers are positive

Number Systems. Both numbers are positive Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of

More information

Chapter 4. Operations on Data

Chapter 4. Operations on Data Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

Number Systems CHAPTER Positional Number Systems

Number Systems CHAPTER Positional Number Systems CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of

More information

In this lesson you will learn: how to add and multiply positive binary integers how to work with signed binary numbers using two s complement how fixed and floating point numbers are used to represent

More information

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

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

More information

Signed umbers. Sign/Magnitude otation

Signed umbers. Sign/Magnitude otation Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

More information

unused unused unused unused unused unused

unused unused unused unused unused unused BCD numbers. In some applications, such as in the financial industry, the errors that can creep in due to converting numbers back and forth between decimal and binary is unacceptable. For these applications

More information

Divide: Paper & Pencil

Divide: Paper & Pencil Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

More information

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

Finite arithmetic and error analysis

Finite arithmetic and error analysis Finite arithmetic and error analysis Escuela de Ingeniería Informática de Oviedo (Dpto de Matemáticas-UniOvi) Numerical Computation Finite arithmetic and error analysis 1 / 45 Outline 1 Number representation:

More information

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

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

More information

COMP Overview of Tutorial #2

COMP Overview of Tutorial #2 COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,

More information

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

More information

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

More information

±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j

±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j ENEE 350 c C. B. Silio, Jan., 2010 FLOATING POINT REPRESENTATIONS It is assumed that the student is familiar with the discussion in Appendix B of the text by A. Tanenbaum, Structured Computer Organization,

More information

(-,+) (+,+) Plotting Points

(-,+) (+,+) Plotting Points Algebra Basics +y (-,+) (+,+) -x +x (-,-) (+,-) Plotting Points -y Commutative Property of Addition/Multiplication * You can commute or move the terms * This only applies to addition and multiplication

More information

Working with Algebraic Expressions

Working with Algebraic Expressions 2 Working with Algebraic Expressions This chapter contains 25 algebraic expressions; each can contain up to five variables. Remember that a variable is just a letter that represents a number in a mathematical

More information

FLOATING POINT FORMATS

FLOATING POINT FORMATS APPENDIX O FLOATING POINT FORMATS Paragraph Title Page 1.0 Introduction... O-1 2.0 IEEE 754 32 Bit Single Precision Floating Point... O-2 3.0 IEEE 754 64 Bit Double Precision Floating Point... O-2 4.0

More information

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a

More information

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 1 DLD P VIDYA SAGAR UNIT I Digital Systems: Binary Numbers, Octal, Hexa Decimal and other base numbers, Number base conversions, complements, signed binary numbers, Floating point number representation, binary codes, error

More information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating Point. CSE 351 Autumn Instructor: Justin Hsia Floating Point CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/899/

More information

Programming Using C Homework 4

Programming Using C Homework 4 Programming Using C Homewk 4 1. In Homewk 3 you computed the histogram of an array, in which each entry represents one value of the array. We can generalize the histogram so that each entry, called a bin,

More information

Digital Fundamentals

Digital Fundamentals Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted

More information

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems

More information

Introduction to Computers and Programming. Numeric Values

Introduction to Computers and Programming. Numeric Values Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000

More information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating Point. CSE 351 Autumn Instructor: Justin Hsia Floating Point CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan Administrivia Lab

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

More information

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997

Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers

More information

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction 1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

More information

3.1 DATA REPRESENTATION (PART C)

3.1 DATA REPRESENTATION (PART C) 3.1 DATA REPRESENTATION (PART C) 3.1.3 REAL NUMBERS AND NORMALISED FLOATING-POINT REPRESENTATION In decimal notation, the number 23.456 can be written as 0.23456 x 10 2. This means that in decimal notation,

More information

More Programming Constructs -- Introduction

More Programming Constructs -- Introduction More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

More information

Computer System and programming in C

Computer System and programming in C 1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign

More information

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

More information

Chapter 4 Section 2 Operations on Decimals

Chapter 4 Section 2 Operations on Decimals Chapter 4 Section 2 Operations on Decimals Addition and subtraction of decimals To add decimals, write the numbers so that the decimal points are on a vertical line. Add as you would with whole numbers.

More information

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions CHAPTER 4 Operations On Data (Solutions to Odd-Numbered Problems) Review Questions 1. Arithmetic operations interpret bit patterns as numbers. Logical operations interpret each bit as a logical values

More information

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation

More information

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

More information

These are reserved words of the C language. For example int, float, if, else, for, while etc.

These are reserved words of the C language. For example int, float, if, else, for, while etc. Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.

More information

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

More information

CHAPTER 1 Numerical Representation

CHAPTER 1 Numerical Representation CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to

More information

CHW 261: Logic Design

CHW 261: Logic Design CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

More information

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754 Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that

More information

Floating-point representations

Floating-point representations Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010

More information

Lesson 1: Arithmetic Review

Lesson 1: Arithmetic Review In this lesson we step back and review several key arithmetic topics that are extremely relevant to this course. Before we work with algebraic expressions and equations, it is important to have a good

More information

Floating-point representations

Floating-point representations Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010

More information

Logic, Words, and Integers

Logic, Words, and Integers Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column 1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's

More information

CS321 Introduction To Numerical Methods

CS321 Introduction To Numerical Methods CS3 Introduction To Numerical Methods Fuhua (Frank) Cheng Department of Computer Science University of Kentucky Lexington KY 456-46 - - Table of Contents Errors and Number Representations 3 Error Types

More information

Floating Point January 24, 2008

Floating Point January 24, 2008 15-213 The course that gives CMU its Zip! Floating Point January 24, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties class04.ppt 15-213, S 08 Floating

More information

Natural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further

Natural Numbers and Integers. Big Ideas in Numerical Methods. Overflow. Real Numbers 29/07/2011. Taking some ideas from NM course a little further Natural Numbers and Integers Big Ideas in Numerical Methods MEI Conference 2011 Natural numbers can be in the range [0, 2 32 1]. These are known in computing as unsigned int. Numbers in the range [ (2

More information

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers Real Numbers We have been studying integer arithmetic up to this point. We have discovered that a standard computer can represent a finite subset of the infinite set of integers. The range is determined

More information

Chapter 2: Number Systems

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

More information

3.5 Floating Point: Overview

3.5 Floating Point: Overview 3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

More information

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers. class04.ppt 15-213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For

More information

Table : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = (

Table : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = ( Floating Point Numbers in Java by Michael L. Overton Virtually all modern computers follow the IEEE 2 floating point standard in their representation of floating point numbers. The Java programming language

More information

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:

More information

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University. Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about

More information

Objectives. Connecting with Computer Science 2

Objectives. Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value

More information

Unit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392

Unit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392 Lesson 1: Multiplying Integers and Decimals, part 1 factor: any two or more numbers multiplied to form a product 56 x 7 = 392 factors: 56, 7 product 392 Integers: all positive and negative whole numbers

More information

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:

More information

Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1

Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions

More information

Number representations

Number representations Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or

More information

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic Clark N. Taylor Department of Electrical and Computer Engineering Brigham Young University clark.taylor@byu.edu 1 Introduction Numerical operations are something at which digital

More information

Chapter 3 Data Representation

Chapter 3 Data Representation Chapter 3 Data Representation The focus of this chapter is the representation of data in a digital computer. We begin with a review of several number systems (decimal, binary, octal, and hexadecimal) and

More information

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. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

More information

CS & IT Conversions. Magnitude 10,000 1,

CS & IT Conversions. Magnitude 10,000 1, CS & IT Conversions There are several number systems that you will use when working with computers. These include decimal, binary, octal, and hexadecimal. Knowing how to convert between these number systems

More information

FP_IEEE_DENORM_GET_ Procedure

FP_IEEE_DENORM_GET_ Procedure FP_IEEE_DENORM_GET_ Procedure FP_IEEE_DENORM_GET_ Procedure The FP_IEEE_DENORM_GET_ procedure reads the IEEE floating-point denormalization mode. fp_ieee_denorm FP_IEEE_DENORM_GET_ (void); DeNorm The denormalization

More information

2 Computation with Floating-Point Numbers

2 Computation with Floating-Point Numbers 2 Computation with Floating-Point Numbers 2.1 Floating-Point Representation The notion of real numbers in mathematics is convenient for hand computations and formula manipulations. However, real numbers

More information

Internal Data Representation

Internal Data Representation Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information

More information

Number System. Introduction. Decimal Numbers

Number System. Introduction. Decimal Numbers Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

More information

FLOATING POINT NUMBERS

FLOATING POINT NUMBERS Exponential Notation FLOATING POINT NUMBERS Englander Ch. 5 The following are equivalent representations of 1,234 123,400.0 x 10-2 12,340.0 x 10-1 1,234.0 x 10 0 123.4 x 10 1 12.34 x 10 2 1.234 x 10 3

More information

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for

More information

Exponents. Although exponents can be negative as well as positive numbers, this chapter will only address the use of positive exponents.

Exponents. Although exponents can be negative as well as positive numbers, this chapter will only address the use of positive exponents. Section 6.2 PRE-ACTIVITY PREPARATION Exponents Exponents enable you to simplify the presentation of a numerical expression containing repeated multiplication into a concise form that is easier to read

More information

Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy.

Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy. Math 340 Fall 2014, Victor Matveev Binary system, round-off errors, loss of significance, and double precision accuracy. 1. Bits and the binary number system A bit is one digit in a binary representation

More information

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation

More information

Chapter 10 - Computer Arithmetic

Chapter 10 - Computer Arithmetic Chapter 10 - Computer Arithmetic Luis Tarrataca luis.tarrataca@gmail.com CEFET-RJ L. Tarrataca Chapter 10 - Computer Arithmetic 1 / 126 1 Motivation 2 Arithmetic and Logic Unit 3 Integer representation

More information

1.2 Round-off Errors and Computer Arithmetic

1.2 Round-off Errors and Computer Arithmetic 1.2 Round-off Errors and Computer Arithmetic 1 In a computer model, a memory storage unit word is used to store a number. A word has only a finite number of bits. These facts imply: 1. Only a small set

More information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating Point. CSE 351 Autumn Instructor: Justin Hsia Floating Point CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/571/

More information

Floating-Point Arithmetic

Floating-Point Arithmetic ENEE446---Lectures-4/10-15/08 A. Yavuz Oruç Professor, UMD, College Park Copyright 2007 A. Yavuz Oruç. All rights reserved. Floating-Point Arithmetic Integer or fixed-point arithmetic provides a complete

More information

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754 Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that

More information

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

More information

Up next. Midterm. Today s lecture. To follow

Up next. Midterm. Today s lecture. To follow Up next Midterm Next Friday in class Exams page on web site has info + practice problems Excited for you to rock the exams like you have been the assignments! Today s lecture Back to numbers, bits, data

More information

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15

More information

CO212 Lecture 10: Arithmetic & Logical Unit

CO212 Lecture 10: Arithmetic & Logical Unit CO212 Lecture 10: Arithmetic & Logical Unit Shobhanjana Kalita, Dept. of CSE, Tezpur University Slides courtesy: Computer Architecture and Organization, 9 th Ed, W. Stallings Integer Representation For

More information

A. Incorrect! To simplify this expression you need to find the product of 7 and 4, not the sum.

A. Incorrect! To simplify this expression you need to find the product of 7 and 4, not the sum. Problem Solving Drill 05: Exponents and Radicals Question No. 1 of 10 Question 1. Simplify: 7u v 4u 3 v 6 Question #01 (A) 11u 5 v 7 (B) 8u 6 v 6 (C) 8u 5 v 7 (D) 8u 3 v 9 To simplify this expression you

More information

Chapter 2 Data Representations

Chapter 2 Data Representations Computer Engineering Chapter 2 Data Representations Hiroaki Kobayashi 4/21/2008 4/21/2008 1 Agenda in Chapter 2 Translation between binary numbers and decimal numbers Data Representations for Integers

More information

System Programming CISC 360. Floating Point September 16, 2008

System Programming CISC 360. Floating Point September 16, 2008 System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:

More information

IEEE Standard 754 Floating Point Numbers

IEEE Standard 754 Floating Point Numbers IEEE Standard 754 Floating Point Numbers Steve Hollasch / Last update 2005-Feb-24 IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based

More information

Project 3: RPN Calculator

Project 3: RPN Calculator ECE267 @ UIC, Spring 2012, Wenjing Rao Project 3: RPN Calculator What to do: Ask the user to input a string of expression in RPN form (+ - * / ), use a stack to evaluate the result and display the result

More information

Numeric Precision 101

Numeric Precision 101 www.sas.com > Service and Support > Technical Support TS Home Intro to Services News and Info Contact TS Site Map FAQ Feedback TS-654 Numeric Precision 101 This paper is intended as a basic introduction

More information

Data Representation Floating Point

Data Representation Floating Point Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:

More information

CS 101: Computer Programming and Utilization

CS 101: Computer Programming and Utilization CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.

More information

Floating Point Numbers

Floating Point Numbers Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran

More information

Floating Point Numbers

Floating Point Numbers Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Fractions in Binary Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU)

More information

Data Representations & Arithmetic Operations

Data Representations & Arithmetic Operations Data Representations & Arithmetic Operations Hiroaki Kobayashi 7/13/2011 7/13/2011 Computer Science 1 Agenda Translation between binary numbers and decimal numbers Data Representations for Integers Negative

More information

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other Kinds Of Data CHAPTER 3 DATA REPRESENTATION Numbers Integers Unsigned Signed Reals Fixed-Point Floating-Point Binary-Coded Decimal Text ASCII Characters Strings Other Graphics Images Video Audio Numbers

More information

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B) Computer Arithmetic Data is manipulated by using the arithmetic instructions in digital computers. Data is manipulated to produce results necessary to give solution for the computation problems. The Addition,

More information