Module 6 Arithmetic. Arithmetic Verb Template  Most COBOL arithmetic verbs conform to the template above. For example; ADD Takings TO CashTotal. ADD.

Slides:



Advertisements
Similar presentations
7-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Advertisements

Binary Addition Rules Adding Binary Numbers = = 1
Physics Rules for using Significant Figures. Rules for Averaging Trials Determine the average of the trials using a calculator Determine the uncertainty.
The Decimal Number System
Addition Subtraction Multiplication Division
1 Chapter 1 Measurements 1.4 Significant Figures in Calculations Copyright © 2009 by Pearson Education, Inc.
Number systems Converting numbers between binary, octal, decimal, hexadecimal (the easy way)
Calculations with Significant Figures
Operations with Scientific Notation
Programming in COBOL-85 For IBM Mainframe System 390
Chapter 5 Using Data and COBOL Operators. Initializing Variables When you define a variable in WORKING- STORAGE, you also can assign it an initial value.
Chapter 2- Decimals.
Module 1 Test Review. Order of Operations The Order of Operations is one of the most important skills that you will need for the rest of your life. Make.
7-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
When dividing a decimal by a whole number, place the decimal point in the quotient directly above the decimal point in the dividend. Then divide as you.
Significant Figures Rules and Applications. Rules for Determining Significant Figures 1.) All Non-Zero digits are Significant. 1.) All Non-Zero digits.
Significant Digits. Why are they important? -Show precision of instruments used -We use them ALL THE TIME in Chemistry -MUST KNOW THE RULES!!
Lesson 5-4 Example Example 2 Find 14 ÷ 4. Show the remainder. 1.Rewrite the problem in vertical format.
7-1 Chapter 7.  Basic Arithmetic Verbs  Options Available with Arithmetic Verbs  COMPUTE Statement  Signed Numbers in Arithmetic Operations  Intrinsic.
Lecture 41 Arithmetic Clauses The ROUNDED clause –Place ROUNDED after the variable that holds the result ADD A TO B ROUNDED. ADD A TO B GIVING C ROUNDED.
Arithmetic and Edited Pictures. Arithmetic Verb Template  Most COBOL arithmetic verbs conform to the template above. For example; ADD Takings TO CashTotal.
7-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Significant Figure Rules RulesExamples The following are always significant Non zero digits Zeros between non zero digits Zero to the right of a non zero.
Accuracy vs. Precision Measurements need to accurate & precise. Accurate -(correct) the measurement is close to the true value. Precise –(reproducible)
Any Questions? Agenda Level 77 Initialize Display & Accept Arithmetic Verbs Compute statement String/Unstring Inspect.
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions Chapter 7.
Chemistry: An Introduction to General, Organic, and Biological Chemistry, Eleventh Edition Copyright © 2012 by Pearson Education, Inc. Chapter 1 Chemistry.
Addition, Subtraction, Multiplication, Division by a whole number, and Division by a decimal.
RULE #1: Standard Scientific Notation is a number from 1 to 9 followed by a decimal and the remaining significant figures and an exponent of 10 to hold.
Significant Digits and Rounding (A review) FOOD SCIENCE MS. MCGRATH.
Any Questions! 2 Agenda Moving data Arithmetic Verbs Compute statement.
Section 2.3. Accuracy: the closeness of measurements to the correct or accepted value of the quantity measured Precision: the closeness of a set of measurements.
Significant Figures. Significant Figure Rules 1) ALL non-zero numbers (1,2,3,4,5,6,7,8,9) are ALWAYS significant. 1) ALL non-zero numbers (1,2,3,4,5,6,7,8,9)
 Scientific notation is simply a method for expressing, and working with, very large or very small numbers. It is a short hand method for writing numbers,
Chapter 1 Whole Numbers Digit – number from 0-9
Mathematical Operations with Significant Figures Ms. McGrath Science 10.
Significant Figures Box and Dot Method. Step 1  Draw a box around all nonzero digits, beginning with the leftmost nonzero digit and ending with the rightmost.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Introduction To Number Systems
1.4 Significant Figures in Calculations
Measurement: Significant Figures
Significant Figures Box and Dot Method.
5.2 The Integers.
Addition Subtraction Multiplication Division
Addition Subtraction Multiplication Division
Scientific Notation.
Rules for Adding, Subtracting, Multiplying, Dividing, and Rounding
Quantitative Measurements
Significant Digits and Rounding (A review)
Multiplying and dividing integers
Addition Subtraction Multiplication Division
Significant Figures
Notes: Scientific Notation
SCIENTIFIC NOTATION.
Addition Subtraction Multiplication Division
Significant Figures or Digits
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
THE COMPUTE STATEMENT Purpose: performs mathematical calculations
Significant Digits Calculations.
Addition Subtraction Multiplication Division
Data Types and Expressions
Significant Figures.
Rules of Divisibility A number is said to be “divisible” by a number if you can divide it by that number and get no remainder.
Sets and Subsets Cornell Notes
Divisibility Rules Dividing by 2
Number systems Converting numbers between binary, octal, decimal, hexadecimal (the easy way)
Data Types and Expressions
Data Types and Expressions
Presentation transcript:

Module 6 Arithmetic

Arithmetic Verb Template  Most COBOL arithmetic verbs conform to the template above. For example; ADD Takings TO CashTotal. ADD Males TO Females GIVING TotalStudents. SUBTRACT Tax FROM GrossPay. SUBTRACT Tax FROM GrossPay GIVING NetPay. DIVIDE Total BY Members GIVING MemberAverage. DIVIDE Members INTO Total GIVING MemberAverage. MULTIPLY 10 BY Magnitude. MULTIPLY Members BY Subs GIVING TotalSubs.  The exceptions are the COMPUTE and the DIVIDE with REMAINDER.

The ROUNDED option Receiving FieldActual ResultTruncated ResultRounded Result PIC 9(3)V PIC 9(3)  The ROUNDED option takes effect when, after decimal point alignment, the result calculated must be truncated on the right hand side.  The option adds 1 to the receiving item when the leftmost truncated digit has an absolute value of 5 or greater.

 A size error condition exists when, after decimal point alignment, the result is truncated on either the left or the right hand side.  If an arithmetic statement has a rounded phrase then a size error only occurs if there is truncation on the left hand side (most significant digits). Receiving FieldActual ResultSIZE ERROR PIC 9(3)V PIC 9(3)V PIC 9(3).124 PIC 9(3).1246 PIC 9(3)V9 Not Rounded PIC 9(3)V9 Rounded PIC 9(3)V9 Rounded The ON SIZE ERROR option YesYesNoYesYesNoYes

ADD Examples ADD Cash TO Total. Before Before After ADD Cash, 20 TO Total, Wage. Before Before After ADD Cash, Total GIVING Result. Before Before After ADD Males TO Females GIVING TotalStudents. Before Before After ADD Cash TO Total. Before Before After ADD Cash, 20 TO Total, Wage. Before Before After ADD Cash, Total GIVING Result. Before Before After ADD Males TO Females GIVING TotalStudents. Before Before After

SUBTRACT Examples SUBTRACT Tax FROM GrossPay, Total. Before Before After SUBTRACT Tax, 80 FROM Total. Before Before After SUBTRACT Tax FROM GrossPay GIVING NetPay. Before Before After SUBTRACT Tax FROM GrossPay, Total. Before Before After SUBTRACT Tax, 80 FROM Total. Before Before After SUBTRACT Tax FROM GrossPay GIVING NetPay. Before Before After

MULTIPLY and DIVIDE Examples MULTIPLY Subs BY Members GIVING TotalSubs ON SIZE ERROR DISPLAY "TotalSubs too small" END-MULTIPLY. Subs Members TotalSubs Subs Members TotalSubs Before Before After MULTIPLY 10 BY Magnitude, Size. Before Before After DIVIDE Total BY Members GIVING Average ROUNDED. Before Before After MULTIPLY Subs BY Members GIVING TotalSubs ON SIZE ERROR DISPLAY "TotalSubs too small" END-MULTIPLY. Subs Members TotalSubs Subs Members TotalSubs Before Before After MULTIPLY 10 BY Magnitude, Size. Before Before After DIVIDE Total BY Members GIVING Average ROUNDED. Before Before After

The Divide Exception DIVIDE 201 BY 10 GIVING Quotient REMAINDER Remain. Before Before After DIVIDE 201 BY 10 GIVING Quotient REMAINDER Remain. Before Before After

Compute IrishPrice = SterlingPrice / Rate * 100. Before Before After Compute IrishPrice = SterlingPrice / Rate * 100. Before Before After The COMPUTE Precedence Rules. Precedence Rules. 1.** 1.**=POWERN N 2.* / 2.*= MULTIPLYx /=DIVIDE÷ =ADD+ -=SUBTRACT- Precedence Rules. Precedence Rules. 1.** 1.**=POWERN N 2.* / 2.*= MULTIPLYx /=DIVIDE÷ =ADD+ -=SUBTRACT-