Imelda C. Go, South Carolina Department of Education, Columbia, SC
|
|
- Silvester Allison
- 6 years ago
- Views:
Transcription
1 PO 082 Rounding in SAS : Preventing Numeric Representation Problems Imelda C. Go, South Carolina Department of Education, Columbia, SC ABSTRACT As SAS programmers, we come from a variety of backgrounds. We range from having little or no formal computer science background to having academic degrees in computer science. Numeric precision and representation are standard topics in computer science education. Programmers eventually encounter numeric precision and representation issues. Their associated problems are particularly harmful when the programmer is not aware that they are present and hence, did not take programming steps to handle such problems. For example, we might notice that our numeric comparison results are not what we expected. Consider the SAS statement if 0.3=3*0.1 then equal='y'; else equal='n'; If you think the result is Y, then this paper is a must-read. Fortunately, there are steps you can take to prevent these types of problem. Note: Due to differences in hardware limitations and operating systems, the PC SAS examples shown below may vary from the results on other computer systems. There is not a commonly used method of performing calculations across computer systems. NOT ALL NUMBERS CAN BE REPRESENTED EXACTLY ON THE COMPUTER Numeric precision (i.e., the accuracy with which a number can be represented) and representation in computers are the roots of the problem. SAS uses floating-point (i.e., real binary) representation. The original decimal number and the binaryrepresented number may be very close, but very close is not the same as equal. There happens to be no exact binary representation for the decimal values of 0.1 and 0.3, which accounts for the difference in example #1 below. The advantage of floating-point representation is speed and its disadvantage is representation error. Repeating decimals and irrational numbers are other obvious problems for exact storage on a computer. For example, 1/3 is equal to a decimal point followed by an infinite number of 3 s. Computers cannot store an infinite number of digits. We need to make a distinction between the expected mathematical result (our decimal values) and what the computer can store (binary values) and program accordingly. Readers may refer to two SAS technical support references (TS-230 and TS- 654) listed at the end of this paper for in-depth explanations and examples regarding floating-point representation. EXAMPLE #1 We know, as a mathematical fact, that 3 multiplied by 0.1 is 0.3. Therefore, when we examine the following code below, it would seem reasonable to expect that the equal variable will have a value of Y because both variables resolve to 0.3 (at least mathematically). If you are thinking the only possible answer is Y, then you are in for surprise! Let s look at the PROC PRINT output for the data set above. If we use the following statement with PROC PRINT, format value1 value ; 1
2 we get the following output. The two values are both 0.3, but that is only as far as the PROC PRINT output goes. The two values are stored in the computer differently. In a later page, we note that SAS formats round and that is why we are not able to see the difference in the values. To see how the values differ, let us use the HEX16. format with PROC PRINT. format value1 value2 hex16.; We get the following output that shows the difference between the two values. EXAMPLE #2 Here is still another example. The difference of both pairs of numbers is mathematically 3.8, but the comparisons fail. Without specifying a format, we get the following results. If we use the following statement with PROC PRINT, we get the following output. format difference 32.31; 2
3 EXAMPLE #3 Representation error can become a serious problem when one is unaware it could even happen and takes no precautions against it. Unaccounted for, the size of the errors or discrepancies could accumulate over multiple operations. Let s take the simple example of adding 0.1 ten trillion times. We know the result should be one trillion. After adding all those numbers, SAS produces the following. Over so many, many calculations, the difference accumulated to How serious is that? It all depends on your data. This might still be tolerable for some and totally unacceptable for others. Something else to think about is what happens to other results when the tainted sum is used in other calculations. COPING WITH THE PROBLEM We are responsible for our data, programs, and results. The first step in solving the problem is identifying the problem and being aware of the conditions under which the problem might create undesirable results. As far as the computer science field is concerned, this is a known problem. Most of the published algorithms for numerical analysis are designed to account for and minimize the effect of representation error. (TS-230) Unfortunately there is no one method that best handles the problems caused by numeric representation error. What is a perfectly good solution for one application may drastically affect the performance and results of another application. (TS-230) Hence, this paper focuses on the simplest examples of this problem. Coping Strategy #1: Keep It Whole The safest way is to just deal with integers or whole numbers. If on a computer, the results of operations on integers are always integers, then there is no problem because an integer can be stored exactly in computers as long as the largest integer value the computer can represent has not been exceeded. Whether you can stay within the realm of integers depends on what data are involved and what needs to be done to the data. Unless you re just adding, subtracting, and multiplying integers with integers, you could encounter a noninteger when it s time to divide an integer with another integer. Consider the following example, which could be monetary amounts, such as dollars and cents. The input values were multiplied by the scale factor of 100 (to transfer the digits after the two decimal places to the integer side of the number). The INT function, which returns the integer value of the argument, is then applied to remove the representation error that might have been introduced by the decimal or fractional portion of the input. 3
4 You can proceed to apply integer arithmetic to the integer values. When you reach the last integer arithmetic result, you can divide it by 100 to regain the decimal portion. You can also apply a similar strategy to percentages. Percentages, such as 18%, can be multiplied by 100 and stored as 18. Coping Strategy #2: Dare to Compare with Rounded Numbers In examples #1 #3 above, representation error manifested itself in the comparison of values. TS-654 recommends that you keep the following in mind when working with nonintegers or real numbers in general, Know your data. Decide on the level of significance you need. Remember that all numeric values are stored in floating-point representation. Use comparison functions, such as ROUND. You can apply the ROUND function at strategic points in the calculation process (e.g., at the end of a series of calculations, after each calculation). What you do depends on the nature of the data, what you have to do with the data, and when representation error might become an issue. Before making an equality comparison, you can round one or both of the operands. An alternative to rounding is specifying to what degree two values are close enough so that they can be considered good as equal as far as your SAS programming is concerned. This process is called fuzzing the comparison. Refer to TS-230 for examples. The ROUND function has the following syntax: ROUND (argument <,rounding-unit>) It rounds the first argument to the nearest multiple of the second argument. When the rounding unit is unspecified, it rounds to the nearest integer. The SAS 9 Language Reference Dictionary reassures us that we can expect to produce decimal arithmetic results if the result has no more than nine significant digits and either of the following conditions are true: The rounding unit is an integer or is a power of 10 greater than or equal to 1E-15. The expected decimal arithmetic result has no more than four decimal places. Refer to the SAS 9 Language Reference Dictionary for more details regarding the ROUND function. Should the ROUND function fail to meet your needs, you may specify your own fuzz factor to use with the ROUND function. TS-230 provides examples of how to do this. Let us modify EXAMPLE #1 to include the ROUND function for both values. This time we can expect the correct mathematical results because the ROUND function returns the value that is based on decimal arithmetic by rounding the values to the first decimal place. 4
5 Let us modify EXAMPLE #2 to include the ROUND function at the point of comparison. Let us modify EXAMPLE #3 to include the ROUND function each time addition occurs. A Word on SAS Formats Let us suppose you have numbers that have been stored with numeric representation error and all you want to do is print them out with their mathematically correct values. According to TS-230, numeric formats round. The HEX16. format is an exception (i.e., it displays the exact value of a variable in exact hexadecimal representation of the 8-byte floating-point number). Another exception is the user-defined PICTURE format, which truncates by default, in PROC FORMAT. Formats affect how numbers are displayed and do not affect how they are stored or represented internally. 5
6 Functions You May Find Useful The ROUND and INT functions are not the only defenses against numeric representation problems. Which function you use depends on the nature of your data and computations. Here is a list of functions described in the SAS 9 Language Reference: Dictionary that you may find helpful or insightful as you develop your strategies against these types of issues. The functions that have zero fuzzing (i.e., CEILZ, FLOORZ, INTZ, MODZ, ROUNDZ) do not try to make their results match the values to be expected with decimal arithmetic. Hence, they may produce unexpected results. In other situations, you may have to create your own function to suit your particular needs. FUNCTION SYNTAX DESCRIPTION CEIL CEIL (argument) Returns the smallest integer that is greater than or equal to the argument, fuzzed to avoid unexpected floating-point results (If the argument is within 1E-12 of an integer, the function returns that integer.) CEILZ CEILZ (argument) Returns the smallest integer that is greater than or equal to the argument, using zero fuzzing FLOOR FLOOR (argument) Returns the largest integer that is less than or equal to the argument, fuzzed to avoid unexpected floating-point results. (If the argument is within 1E-12 of an integer, the function returns that integer.) FLOORZ FLOORZ (argument) Returns the largest integer that is less than or equal to the argument, using zero fuzzing FUZZ FUZZ (argument) Returns the nearest integer if the argument is within 1E-12 INT INT (argument) Returns the integer value, fuzzed to avoid unexpected floating-point results (If the argument is within 1E-12 of an integer, the function returns that integer.) INTZ INTZ (argument) Returns the integer portion of the argument, using zero fuzzing MOD MOD (argument-1, argument-2) Returns the remainder from the division of the first argument by the second argument, fuzzed to avoid unexpected floating-point results MODZ MOD (argument-1, argument-2) Returns the remainder from the division of the first argument by the second argument, using zero fuzzing ROUND ROUND (argument <,rounding-unit>) Rounds the first argument to the nearest multiple of the second argument, or to the nearest integer when the second argument is omitted ROUNDE ROUNDE (argument <,rounding-unit>) Rounds the first argument to the nearest multiple of the second argument, and returns an even multiple when the first argument is halfway between the two nearest multiples ROUNDZ ROUNDZ (argument <,rounding-unit>) Rounds the first argument to the nearest multiple of the second argument, with zero fuzzing REFERENCES SAS Institute Inc SAS 9 Language Reference: Concepts. Cary, NC: SAS Institute Inc. SAS Institute Inc SAS 9 Language Reference: Dictionary, Volumes 1 and 2. Cary, NC: SAS Institute Inc. TS-230: Dealing with numeric representation error in SAS applications. Retrieved July 1, 2008, from the SAS Web site: TS-654: Numeric precision 101. Retrieved July 1, 2008, from the SAS Web site: TRADEMARK NOTICE SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. 6
Mastering the Basics: Preventing Problems by Understanding How SAS Works. Imelda C. Go, South Carolina Department of Education, Columbia, SC
SESUG 2012 ABSTRACT Paper PO 06 Mastering the Basics: Preventing Problems by Understanding How SAS Works Imelda C. Go, South Carolina Department of Education, Columbia, SC There are times when SAS programmers
More informationHandling Numeric Representation SAS Errors Caused by Simple Floating-Point Arithmetic Computation Fuad J. Foty, U.S. Census Bureau, Washington, DC
Paper BB-206 Handling Numeric Representation SAS Errors Caused by Simple Floating-Point Arithmetic Computation Fuad J. Foty, U.S. Census Bureau, Washington, DC ABSTRACT Every SAS programmer knows that
More informationNumeric 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 information1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM
1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number
More informationBits, 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 informationLesson 5: Introduction to the Java Basics: Java Arithmetic THEORY. Arithmetic Operators
Lesson 5: Introduction to the Java Basics: Java Arithmetic THEORY Arithmetic Operators There are four basic arithmetic operations: OPERATOR USE DESCRIPTION + op1 + op2 Adds op1 and op2 - op1 + op2 Subtracts
More informationCS321. Introduction to Numerical Methods
CS31 Introduction to Numerical Methods Lecture 1 Number Representations and Errors Professor Jun Zhang Department of Computer Science University of Kentucky Lexington, KY 40506 0633 August 5, 017 Number
More informationExample 2: Simplify each of the following. Round your answer to the nearest hundredth. a
Section 5.4 Division with Decimals 1. Dividing by a Whole Number: To divide a decimal number by a whole number Divide as you would if the decimal point was not there. If the decimal number has digits after
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationWill introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators
Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships
More informationFloating 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 informationExcerpt from "Art of Problem Solving Volume 1: the Basics" 2014 AoPS Inc.
Chapter 5 Using the Integers In spite of their being a rather restricted class of numbers, the integers have a lot of interesting properties and uses. Math which involves the properties of integers is
More informationLearning the Language - V
Learning the Language - V Fundamentals We now have locations to store things so we need a way to get things into those storage locations To do that, we use assignment statements Deja Moo: The feeling that
More informationFloating 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 informationSigned 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 informationFormats. Formats Under UNIX. HEXw. format. $HEXw. format. Details CHAPTER 11
193 CHAPTER 11 Formats Formats Under UNIX 193 Formats Under UNIX This chapter describes SAS formats that have behavior or syntax that is specific to UNIX environments. Each format description includes
More informationRoundoff Errors and Computer Arithmetic
Jim Lambers Math 105A Summer Session I 2003-04 Lecture 2 Notes These notes correspond to Section 1.2 in the text. Roundoff Errors and Computer Arithmetic In computing the solution to any mathematical problem,
More informationOperators in C. Staff Incharge: S.Sasirekha
Operators in C Staff Incharge: S.Sasirekha Operators An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C
More informationNumeral Systems. -Numeral System -Positional systems -Decimal -Binary -Octal. Subjects:
Numeral Systems -Numeral System -Positional systems -Decimal -Binary -Octal Subjects: Introduction A numeral system (or system of numeration) is a writing system for expressing numbers, that is a mathematical
More informationSystems 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 informationChapter 1. Numeric Artifacts. 1.1 Introduction
Chapter 1 Numeric Artifacts 1.1 Introduction Virtually all solutions to problems in electromagnetics require the use of a computer. Even when an analytic or closed form solution is available which is nominally
More informationCHAPTER 2 Number Systems
CHAPTER 2 Number Systems Objectives After studying this chapter, the student should be able to: Understand the concept of number systems. Distinguish between non-positional and positional number systems.
More informationName Period Date. REAL NUMBER SYSTEM Student Pages for Packet 3: Operations with Real Numbers
Name Period Date REAL NUMBER SYSTEM Student Pages for Packet : Operations with Real Numbers RNS. Rational Numbers Review concepts of experimental and theoretical probability. a Understand why all quotients
More informationUnit 3. Operators. School of Science and Technology INTRODUCTION
INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.
More informationMath 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 informationFloating Point Considerations
Chapter 6 Floating Point Considerations In the early days of computing, floating point arithmetic capability was found only in mainframes and supercomputers. Although many microprocessors designed in the
More informationFloating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !
Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More informationOutline. Data and Operations. Data Types. Integral Types
Outline Data and Operations Data Types Arithmetic Operations Strings Variables Declaration Statements Named Constant Assignment Statements Intrinsic (Built-in) Functions Data and Operations Data and Operations
More informationFloating 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 information3.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 informationTopic 2: Decimals. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra
41 Topic 2: Decimals Topic 1 Integers Topic 2 Decimals Topic 3 Fractions Topic 4 Ratios Duration 1/2 week Content Outline Introduction Addition and Subtraction Multiplying and Dividing by Multiples of
More informationFloating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point
More informationPROC MEANS for Disaggregating Statistics in SAS : One Input Data Set and One Output Data Set with Everything You Need
ABSTRACT Paper PO 133 PROC MEANS for Disaggregating Statistics in SAS : One Input Data Set and One Output Data Set with Everything You Need Imelda C. Go, South Carolina Department of Education, Columbia,
More information1. Let n be a positive number. a. When we divide a decimal number, n, by 10, how are the numeral and the quotient related?
Black Converting between Fractions and Decimals Unit Number Patterns and Fractions. Let n be a positive number. When we divide a decimal number, n, by 0, how are the numeral and the quotient related?.
More informationSystem 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 informationUsing Arithmetic of Real Numbers to Explore Limits and Continuity
Using Arithmetic of Real Numbers to Explore Limits and Continuity by Maria Terrell Cornell University Problem Let a =.898989... and b =.000000... (a) Find a + b. (b) Use your ideas about how to add a and
More informationDivide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
More informationPython Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17
Python Numbers CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17 1 (adapted from Meeden, Evans & Mayberry) 2 Learning Outcomes To become familiar with the basic
More information9 abcd = dcba b + 90c = c + 10b b = 10c.
In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should
More informationFinite 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 informationSection 1.4 Mathematics on the Computer: Floating Point Arithmetic
Section 1.4 Mathematics on the Computer: Floating Point Arithmetic Key terms Floating point arithmetic IEE Standard Mantissa Exponent Roundoff error Pitfalls of floating point arithmetic Structuring computations
More informationWhat Every Programmer Should Know About Floating-Point Arithmetic
What Every Programmer Should Know About Floating-Point Arithmetic Last updated: October 15, 2015 Contents 1 Why don t my numbers add up? 3 2 Basic Answers 3 2.1 Why don t my numbers, like 0.1 + 0.2 add
More informationChapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers
Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers
More informationAdvanced features of the Calculate signal tool
Advanced features of the Calculate signal tool Case study: how to us the advanced features of the Calculate signal tool? 1 The calculate signal tool The calculate signal tool is one of the most useful
More informationNumber Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr
Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems
More informationDivisibility Rules and Their Explanations
Divisibility Rules and Their Explanations Increase Your Number Sense These divisibility rules apply to determining the divisibility of a positive integer (1, 2, 3, ) by another positive integer or 0 (although
More informationFloating 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 informationcast int( x float( x str( x hex( int string int oct( int string int bin( int string int chr( int int ord( ch
More About Values Casts To cast is to take a value of one type and return the corresponding value of some other type (or an error, if the cast is impossible) int(x) casts a string, float, or boolean x
More informationTopic C. Communicating the Precision of Measured Numbers
Topic C. Communicating the Precision of Measured Numbers C. page 1 of 14 Topic C. Communicating the Precision of Measured Numbers This topic includes Section 1. Reporting measurements Section 2. Rounding
More informationChapter 2: Number Systems
Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 18, 2017 at 12:48 CS429 Slideset 4: 1 Topics of this Slideset
More informationGiving credit where credit is due
CSCE 230J Computer Organization Floating Point Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this lecture are based
More informationunused 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 informationGiving credit where credit is due
JDEP 284H Foundations of Computer Systems Floating Point Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant
More informationData Representation. Variable Precision and Storage Information. Numeric Variables in the Alpha Environment CHAPTER 9
199 CHAPTER 9 Data Representation Variable Precision and Storage Information 199 Numeric Variables in the Alpha Environment 199 Numeric Variables in the VAX Environment 200 Missing Values 201 Variable
More informationBeginner Beware: Hidden Hazards in SAS Coding
ABSTRACT SESUG Paper 111-2017 Beginner Beware: Hidden Hazards in SAS Coding Alissa Wise, South Carolina Department of Education New SAS programmers rely on errors, warnings, and notes to discover coding
More informationEC121 Mathematical Techniques A Revision Notes
EC Mathematical Techniques A Revision Notes EC Mathematical Techniques A Revision Notes Mathematical Techniques A begins with two weeks of intensive revision of basic arithmetic and algebra, to the level
More informationModular Arithmetic. is just the set of remainders we can get when we divide integers by n
20181004 Modular Arithmetic We are accustomed to performing arithmetic on infinite sets of numbers. But sometimes we need to perform arithmetic on a finite set, and we need it to make sense and be consistent
More information9 abcd = dcba b + 90c = c + 10b b = 10c.
In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should
More informationComputer Arithmetic Floating Point
Computer Arithmetic Floating Point Chapter 3.6 EEC7 FQ 25 About Floating Point Arithmetic Arithmetic basic operations on floating point numbers are: Add, Subtract, Multiply, Divide Transcendental operations
More informationThe float type and more on variables FEB 6 TH 2012
The float type and more on variables FEB 6 TH 2012 The float type Numbers with decimal points are easily represented in binary: 0.56 (in decimal) = 5/10 + 6/100 0.1011 (in binary) = ½+0/4 + 1/8 +1/16 The
More informationLong (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000.
QuickCalc User Guide. Number Representation, Assignment, and Conversion Variables Constants Usage Double (or DOUBLE ) floating-point variables (approx. 16 significant digits, range: approx. ±10 308 The
More informationIn 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 informationComputer Arithmetic. In this article we look at the way in which numbers are represented in binary form and manipulated in a computer.
Computer Arithmetic In this article we look at the way in which numbers are represented in binary form and manipulated in a computer. Numbers have a long history. In Europe up to about 400 numbers were
More information1.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 informationFloating Point Representation in Computers
Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things can go wrong What are Floating Point Numbers? Any
More information50 MATHCOUNTS LECTURES (6) OPERATIONS WITH DECIMALS
BASIC KNOWLEDGE 1. Decimal representation: A decimal is used to represent a portion of whole. It contains three parts: an integer (which indicates the number of wholes), a decimal point (which separates
More information1. Variables 2. Arithmetic 3. Input and output 4. Problem solving: first do it by hand 5. Strings 6. Chapter summary
Topic 2 1. Variables 2. Arithmetic 3. Input and output 4. Problem solving: first do it by hand 5. Strings 6. Chapter summary Arithmetic Operators C++ has the same arithmetic operators as a calculator:
More informationLevel ISA3: Information Representation
Level ISA3: Information Representation 1 Information as electrical current At the lowest level, each storage unit in a computer s memory is equipped to contain either a high or low voltage signal Each
More informationContinued Fractions: A Step-by-Step Tutorial, with User RPL Implementations
Continued Fractions: A Step-by-Step Tutorial, with User RPL Implementations by Joseph K. Horn, for HHC 202 Table of contents I. How to convert decimal fractions & simple fractions into continued fractions.
More informationReal 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 informationIntroduction to Scientific Computing Lecture 1
Introduction to Scientific Computing Lecture 1 Professor Hanno Rein Last updated: September 10, 2017 1 Number Representations In this lecture, we will cover two concept that are important to understand
More informationInternal Data Representation
Appendices This part consists of seven appendices, which provide a wealth of reference material. Appendix A primarily discusses the number systems and their internal representation. Appendix B gives information
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors
More informationExcerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997
Excerpt from: Stephen H. Unger, The Essence of Logic Circuits, Second Ed., Wiley, 1997 APPENDIX A.1 Number systems and codes Since ten-fingered humans are addicted to the decimal system, and since computers
More informationSection 1.2 Fractions
Objectives Section 1.2 Fractions Factor and prime factor natural numbers Recognize special fraction forms Multiply and divide fractions Build equivalent fractions Simplify fractions Add and subtract fractions
More informationBinary, Hexadecimal and Octal number system
Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of
More informationReal 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 informationA Different Content and Scope for School Arithmetic
Journal of Mathematics Education July 207, Vol. 0, No., pp. 09-22 Education for All DOI: https://doi.org/0.267/00757752790008 A Different Content and Scope for School Arithmetic Patricia Baggett New Mexico
More informationLesson 1: Arithmetic Review
Lesson 1: Arithmetic Review Topics and Objectives: Order of Operations Fractions o Improper fractions and mixed numbers o Equivalent fractions o Fractions in simplest form o One and zero Operations on
More informationPRIMITIVE VARIABLES. CS302 Introduction to Programming University of Wisconsin Madison Lecture 3. By Matthew Bernstein
PRIMITIVE VARIABLES CS302 Introduction to Programming University of Wisconsin Madison Lecture 3 By Matthew Bernstein matthewb@cs.wisc.edu Variables A variable is a storage location in your computer Each
More informationModule 1: Information Representation I -- Number Systems
Unit 1: Computer Systems, pages 1 of 7 - Department of Computer and Mathematical Sciences CS 1305 Intro to Computer Technology 1 Module 1: Information Representation I -- Number Systems Objectives: Learn
More informationROUNDING ERRORS LAB 1. OBJECTIVE 2. INTRODUCTION
ROUNDING ERRORS LAB Imagine you are traveling in Italy, and you are trying to convert $27.00 into Euros. You go to the bank teller, who gives you 20.19. Your friend is with you, and she is converting $2,700.00.
More informationadd and subtract whole numbers with more than 4 digits, including using formal written methods (columnar addition and subtraction)
I created these worksheets because I think it is useful to have regular practice of calculation methods away from the point of teaching. There are worksheets. Questions are aligned to the Year curriculum,
More informationChapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude
Chapter 2 Positional number systems A positional number system represents numeric values as sequences of one or more digits. Each digit in the representation is weighted according to its position in the
More informationLesson 4.02: Operations with Radicals
Lesson 4.02: Operations with Radicals Take a Hike! Sheldon is planning on taking a hike through a state park. He has mapped out his route carefully. He plans to hike 3 miles to the scenic overlook, and
More information9/10/10. Arithmetic Operators. Today. Assigning floats to ints. Arithmetic Operators & Expressions. What do you think is the output?
Arithmetic Operators Section 2.15 & 3.2 p 60-63, 81-89 1 Today Arithmetic Operators & Expressions o Computation o Precedence o Associativity o Algebra vs C++ o Exponents 2 Assigning floats to ints int
More informationHexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those?
9/10/18 1 Binary and Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those? Hexadecimal Numbers Check Homework 3 Binary Numbers A binary (base-two) number
More informationArithmetic. 2.2.l Basic Arithmetic Operations. 2.2 Arithmetic 37
2.2 Arithmetic 37 This is particularly important when programs are written by more than one person. It may be obvious to you that cv stands for can volume and not current velocity, but will it be obvious
More information2.Simplification & Approximation
2.Simplification & Approximation As we all know that simplification is most widely asked topic in almost every banking exam. So let us try to understand what is actually meant by word Simplification. Simplification
More informationDigital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand
Digital Arithmetic Digital Arithmetic: Operations and Circuits Dr. Farahmand Binary Arithmetic Digital circuits are frequently used for arithmetic operations Fundamental arithmetic operations on binary
More informationNumbers 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(Refer Slide Time: 02:59)
Numerical Methods and Programming P. B. Sunil Kumar Department of Physics Indian Institute of Technology, Madras Lecture - 7 Error propagation and stability Last class we discussed about the representation
More informationProgramming for Engineers Introduction to C
Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines
More informationTopic 3: Fractions. Topic 1 Integers. Topic 2 Decimals. Topic 3 Fractions. Topic 4 Ratios. Topic 5 Percentages. Topic 6 Algebra
Topic : Fractions Topic Integers Topic Decimals Topic Fractions Topic Ratios Topic Percentages Duration / weeks Content Outline PART (/ week) Introduction Converting Fractions to Decimals Converting Decimals
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text
More informationObjectives. 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 informationCPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS
CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS Aleksandar Milenković The LaCASA Laboratory, ECE Department, The University of Alabama in Huntsville Email: milenka@uah.edu Web:
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More informationMaciej Sobieraj. Lecture 1
Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They
More information