Numerical Computation Review and Continuation CS-2301, B-Term 20091 Numerical Computation in C Review and Continuation CS-2301, System Programming for.

Slides:



Advertisements
Similar presentations
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
Advertisements

1 ICS103 Programming in C Lecture 4: Data Types, Operators & Expressions.
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
Introduction to Computers and Programming Lecture 4: Mathematical Operators New York University.
© 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5/e Starting Out with C++: Early Objects 5 th Edition Chapter 2 Introduction.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming Expressions and Operators Program Style.
More on Numerical Computation CS-2301 B-term More on Numerical Computation CS-2301, System Programming for Non-majors (Slides include materials from.
Numerical Computation in C CS-2301 D-term Numerical Computation in C CS-2301 System Programming for Non-majors, C-term 2009 (Slides include materials.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Expressions An expression is a sequence of operands and operators that reduces to a single value expression operator operand An operator is a language-specific.
Symbolic Constants in CCS-2303, C-Term Digression – Symbolic Constants in C CS-2303, System Programming Concepts (Slides include materials from The.
More about Numerical Computation CS-2301, B-Term More about Numerical Computation CS-2301, System Programming for Non-Majors (Slides include materials.
Chapter 2: Introduction to C++.
Introduction to C Programming
Basic Elements of C++ Chapter 2.
Expressions, Data Conversion, and Input
CSC 125 Introduction to C++ Programming Chapter 2 Introduction to C++
1 Lab Session-III CSIT-120 Fall 2000 Revising Previous session Data input and output While loop Exercise Limits and Bounds Session III-B (starts on slide.
Ryan Chu. Arithmetic Expressions Arithmetic expressions consist of operators, operands, parentheses, and function calls. The purpose is to specify an.
Copyright 2006 Addison-Wesley Brief Version of Starting Out with C++ Chapter 2 Introduction to C++
Chapter 2 part #4 Operator
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Assignment Statements Operator Precedence. ICS111-Java Programming Blanca Polo 2 Assignment, not Equals  An assignment statement changes the value of.
Copyright © 2012 Pearson Education, Inc. Chapter 2: Introduction to C++
Chapter 2 Overview of C++. 2 Overview  2.1 Language Elements  2.2 Reserved Words & Identifiers  2.3 Data Types & Declarations  2.4 Input/Output 
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Numerical Computation in C C Programming by Ali iskurt 1 Numerical Computation in C Computer Programmin in C Fall Semester (Slides include materials.
Pointers: Basics. 2 What is a pointer? First of all, it is a variable, just like other variables you studied  So it has type, storage etc. Difference:
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 2: Introduction to C++
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2: Introduction to C++ Starting Out with C++ Early Objects Sixth.
Operators and Expressions. 2 String Concatenation  The plus operator (+) is also used for arithmetic addition  The function that the + operator performs.
Chapter 4: Expressions Copyright © 2008 W. W. Norton & Company. All rights reserved. 1 Chapter 4 Expressions.
Arithmetic Expressions in C++. CSCE 1062 Outline Data declaration {section 2.3} Arithmetic operators in C++ {section 2.6} Mixed data type arithmetic in.
Types of C Variables:  The following are some types of C variables on the basis of constants values it has. For example: ○ An integer variable can hold.
CSC 1051 – Algorithms and Data Structures I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
1 Week 5 l Primitive Data types l Assignment l Expressions l Documentation & Style Primitive Types, Assignments, and Expressions.
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.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
 Most C programs perform calculations using the C arithmetic operators (Fig. 2.9).  Note the use of various special symbols not used in algebra.  The.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
Pointers: Basics. 2 Address vs. Value Each memory cell has an address associated with it
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
2.1 The Part of a C++ Program. The Parts of a C++ Program // sample C++ program #include using namespace std; int main() { cout
ECE 103 Engineering Programming Chapter 4 Operators Herbert G. Mayer, PSU Status 6/10/2016 Initial content copied verbatim from ECE 103 material developed.
Variables, Operators, and Expressions
Chapter Topics The Basics of a C++ Program Data Types
Chapter 2: Introduction to C++
ICS103 Programming in C Lecture 4: Data Types, Operators & Expressions
BASIC ELEMENTS OF A COMPUTER PROGRAM
ITEC113 Algorithms and Programming Techniques
Basic Elements of C++.
Data Types, Identifiers, and Expressions
Multiple variables can be created in one declaration
Variables, Expressions, and IO
Chapter 2: Introduction to C++
Basic Elements of C++ Chapter 2.
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
Data Types, Identifiers, and Expressions
Expressions Chapter 4 Copyright © 2008 W. W. Norton & Company.
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
2.1 Parts of a C++ Program.
Expressions Chapter 4 Copyright © 2008 W. W. Norton & Company.
More about Numerical Computation
Symbolic Constants in C
Differences between Java and C
Lecture3.
CS150 Introduction to Computer Science 1
Chapter 2: Introduction to C++.
Presentation transcript:

Numerical Computation Review and Continuation CS-2301, B-Term Numerical Computation in C Review and Continuation CS-2301, System Programming for Non-Majors (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie and from C: How to Program, 5 th and 6 th editions, by Deitel and Deitel)

Numerical Computation Review and Continuation CS-2301, B-Term Simple Program Example #include const double pi = ; int main () { unsigned int n; double r, length; printf(″Enter # of ″ ″sides:- ″); scanf(″%u″, &n); printf(″Enter radius″ ″:- ″); scanf(″%lf″, &r); /* calculate length */ length = 2 * r * sin(pi/n); printf(″The length of ″ ″a side of an %u-″ ″sided polygon of ″ ″radius %f is %f.″ ″\n″, n, r, length); return 0; }// main Purpose: To calculate the length of one side of a polygon given the number of sides and the radius of the circumscribing circle.

Numerical Computation Review and Continuation CS-2301, B-Term Things We Have Seen So Far #include Compiler Directive: instructs the compiler to copy program text from some file into your program Header File: ends in.h — the file that is included Purpose – to declare functions, variables, and other stuff provided elsewhere (e.g., by other.c files!). Declaration and Definition Introduces a new identifier and gives meaning to it Specifies what type, how initialized, etc. Definition: specifies storage or code associated with the identifier

Numerical Computation Review and Continuation CS-2301, B-Term Simple Program Example #include const double pi = ; int main () { unsigned int n; double r, length; printf(″Enter # of ″ ″sides:- ″); scanf(″%u″, &n); printf(″Enter radius″ ″:- ″); scanf(″%lf″, &r); /* calculate length */ length = 2 * r * sin(pi/n); printf(″The length of ″ ″a side of an %u-″ ″sided polygon of ″ ″radius %f is %f.″ ″\n″, n, r, length); return 0; }// main Header Files

Numerical Computation Review and Continuation CS-2301, B-Term Simple Program Example #include const double pi = ; int main () { unsigned int n; double r, length; printf(″Enter # of ″ ″sides:- ″); scanf(″%u″, &n); printf(″Enter radius″ ″:- ″); scanf(″%lf″, &r); /* calculate length */ length = 2 * r * sin(pi/n); printf(″The length of ″ ″a side of an %u-″ ″sided polygon of ″ ″radius %f is %f.″ ″\n″, n, r, length); return 0; }// main Declarations and Definitions: Introduces new names Sets aside storage space for data or code for function

Numerical Computation Review and Continuation CS-2301, B-Term Things We Have Seen So Far (continued) Comments: Anything between '/*' and '*/' ; may span lines Anything after '//' and end of line Equivalent to White Space White Space A blank, tab, new line, vertical tab, form feed, or comment Separates identifiers and constants from each other and from reserved words Reserved Words Identifiers with special meaning to C programs; may not be used for any other purpose

Numerical Computation Review and Continuation CS-2301, B-Term Simple Program Example #include const double pi = ; int main () { unsigned int n; double r, length; printf(″Enter # of ″ ″sides:- ″); scanf(″%u″, &n); printf(″Enter radius″ ″:- ″); scanf(″%lf″, &r); /* calculate length */ length = 2 * r * sin(pi/n); printf(″The length of ″ ″a side of an %u-″ ″sided polygon of ″ ″radius %f is %f.″ ″\n″, n, r, length); return 0; }// main A Comment A reserved word Another Comment

Numerical Computation Review and Continuation CS-2301, B-Term Simple Program Example #include const double pi = ; int main () { unsigned int n; double r, length; printf(″Enter # of ″ ″sides:- ″); scanf(″%u″, &n); printf(″Enter radius″ ″:- ″); scanf(″%lf″, &r); /* calculate length */ length = 2 * r * sin(pi/n); printf(″The length of ″ ″a side of an %u-″ ″sided polygon of ″ ″radius %f is %f.″ ″\n″, n, r, length); return 0; }// main Functions used in our program but declared in header files

Numerical Computation Review and Continuation CS-2301, B-Term More about Numerical Computation More on Declarations and Definitions Assignment statements Expressions Operator Precedence

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data unsigned int i; int j, k; short m = 0; long n = m; … Allocate a memory location big enough to hold an unsigned integer. Name of that location is i

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data unsigned int i; int j, k; short m = 0; long n = m; … Allocate two memory locations, each big enough to hold an integer. Names of those locations are j and k Cannot count on them being in contiguous locations

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data unsigned int i; int j, k; short m = 0; long n = m; … Allocate a memory location big enough to hold a short integer. –i.e., short int m = 0 Name of that location is m Initialize the value of that location to 0 –Note: none of the previous integers have been initialized

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data unsigned int i; int j, k; short m = 0; long n = m; … Allocate a memory location big enough to hold a long integer. Name of that location is n Initialize the value of that location to the value stored in m

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data unsigned int i; int j, k; short m = 0; long n = k; … What if we had tried to initialize it to k instead? What would value of n be?

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data (continued) double a; float b = 3.5; float d = 9.3e6; double e = 2.1e-8; … Same as previous, but for floating point data

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data (continued) double a; float b = 3.5; float d = 9.3e6; double e = 2.1e-8; … Same as previous, but for floating point data Note the decimalized notation for the initialization

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data (continued) double a; float b = 3.5; float d = 9.3e6; double e = 2.1e-8; … Any numerical constant with a decimal point is a floating point number! 2.0 is a floating point constant 2 is an integer constant This makes a difference in some programs.

Numerical Computation Review and Continuation CS-2301, B-Term Definitions of Numeric Data (continued) double a; float b = 3.5; float d = 9.3e6; double e = 2.1e-8; … Scientific notation for initializations – i.e., –9.3  10 6 –2.1  10 -8

Numerical Computation Review and Continuation CS-2301, B-Term Questions?

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Operator location ‘ = ’ value –Assigns the value from the right side to the memory location defined by the left E.g., –i = 3 –j = i –f = sin(x) –g = expression Note: computer scientists often refer to the location as the l-value (i.e., left value; see p.197)

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Operator location ‘ = ’ value –Assigns the value from the right side to the memory location defined by the left E.g., –i = 3 –j = i –f = sin(x) –g = expression Assign the value 3 to the location i

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Operator location ‘ = ’ value –Assigns the value from the right side to the memory location defined by the left E.g., –i = 3 –j = i –f = sin(x) –g = expression Assign the value from location i to location j

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Operator location ‘ = ’ value –Assigns the value from the right side to the memory location defined by the left E.g., –i = 3 –j = i –f = sin(x) –g = expression Apply the sin function to the value at location x and store the result in location f

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Operator location ‘ = ’ value –Assigns the value from the right side to the memory location defined by the left E.g., –i = 3 –j = i –f = sin(x) –g = expression Evaluate the expression (see below) and store the result in location g

Numerical Computation Review and Continuation CS-2301, B-Term Note A declaration of a variable with an initial value is equivalent to an assignment to that variable. E.g., float b = 3.5; is the same as float b; b = 3.5;

Numerical Computation Review and Continuation CS-2301, B-Term Questions?

Numerical Computation Review and Continuation CS-2301, B-Term Definition — Expression A sequence of operands and operators that, when evaluated, produce a result value Always scanned left-to-right by compiler –However, precedence of operators may define a different order of evaluation (see below)

Numerical Computation Review and Continuation CS-2301, B-Term Arithmetic Operators Unary – ‘ + ’ and ‘ – ’ Indicates sign of numerical value Additive – ‘ + ’ and ‘ – ’ Adds or subtracts two numbers, returns sum or difference Multiplicative – ‘ * ’, ‘ / ’, and ‘ % ’ ‘ * ’ – multiplies to numbers together, returns product ‘ / ’ – divides first number by second, returns quotient ‘ % ’ – integer division, returns remainder … E.g., -3.2, +5 -x, +i -sin(x)

Numerical Computation Review and Continuation CS-2301, B-Term Arithmetic Expressions a*x + b c*c + 2*c*d + d*d c*c*c + 3*c*c*d + 3*c*d*d + d*d*d 1/(1/v1 + 1/v2) (minutes1 + minutes2) % 60

Numerical Computation Review and Continuation CS-2301, B-Term Arithmetic Expressions (continued) Arithmetic expressions always return a value of the same type as their operands Type conversion rules apply if operands are of different or mixed types See §A.2, pp More later '/', and '%' are undefined if divisor is zero

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Operator (again) ‘ = ’ — assigns value of the expression on the right to memory location defined by left y = a*x + b; i = j + 1; z = y = a*x + b; Note: assignment is just another operator in an expression Value of the assignment expression is the value assigned

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Expression ‘ = ’ — assigns value of the expression on the right to memory location defined by left Returns the value assigned y = a*x + b; i = j + 1; z = y = a*x + b; Evaluate this expression first

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Expression (continued) ‘ = ’ — assigns value of the expression on the right to memory location defined by left Returns the value assigned y = a*x + b; i = j + 1; z = y = a*x + b; 33 Assign the result here

Numerical Computation Review and Continuation CS-2301, B-Term Assignment Expression (continued) ‘ = ’ — assigns value of the expression on the right to memory location defined by left Returns the value assigned y = a*x + b; i = j + 1; z = y = a*x + b; 34 Assign that result here

Numerical Computation Review and Continuation CS-2301, B-Term Questions?

Numerical Computation Review and Continuation CS-2301, B-Term Specifying Symbolic Constants in C Two ways –Textual substitution –Declaration of const data object

Numerical Computation Review and Continuation CS-2301, B-Term Constant – Textual Substitution See page 14 & 89 in K&R #define NAME replacement-text E.g., #define PI #define LOWER 0 #define UPPER 300 #define STEP 20 It is traditional in C for textual substitution names to be all UPPER CASE

Numerical Computation Review and Continuation CS-2301, B-Term Constant – Textual Substitution See page 14 & 89 in K&R #define NAME replacement-text E.g., #define PI #define LOWER 0 #define UPPER 300 #define STEP 20 When a textual substitution constant is used in a program, the compiler simply substitutes the replacement text on the fly

Numerical Computation Review and Continuation CS-2301, B-Term Constant – Textual Substitution (continued) #define is a Compiler Directive –Instructs compiler to re-write the code by substituting the definition for the defined word –No meaning is attached to the substitution

Numerical Computation Review and Continuation CS-2301, B-Term Constant Declaration const double pi = ; const double c = e+8; /* speed of light in meters/sec */ Defines a value of the declared type with the declared name I.e., creates storage to hold this value Must be initialized May never be used on left side of an assignment

Numerical Computation Review and Continuation CS-2301, B-Term Questions?

Numerical Computation Review and Continuation CS-2301, B-Term Introduction to Operator Precedence Suppose you encounter the following expressions in a math, physics, or engineering problem:– How do you represent them in C and what order should the operators be evaluated?

Numerical Computation Review and Continuation CS-2301, B-Term Arithmetic Expressions with Multiple Operators pow(x,3) + 3*pow(x,2)*y + 3*x*pow(y,2) + pow(y,3) 1 st 2 nd 3 rd 4 th 5 th 6 th 8 th 7 th 9 th 10 th 11 th Value of expression

Numerical Computation Review and Continuation CS-2301, B-Term Exercise – Do the same for this expression Representation as a C expression Order of operations

Numerical Computation Review and Continuation CS-2301, B-Term Definitions Operator Precedence –The relative order in which operators in an expression in C are executed Operator Associativity –When two operators are of same precedence, whether the left or right operator is applied first See Table 2-1, p. 53 A very important topic. Easy to get tripped up. Source of lots of errors!

Numerical Computation Review and Continuation CS-2301, B-Term Operator Precedence Table A portion of the table is:– ( )/* highest – function call and parenthesization */ + -/* unary, right to left*/ * / %/* two operands, left to right */ + -/* two operands, l-to-r*/ =/* assignment, right to left */,/* lowest – sequence of expressions */

Numerical Computation Review and Continuation CS-2301, B-Term Operator Precedence When scanning an expression … A pending operator is not applied until it is of higher precedence than the next operator or It has the same precedence and associativity is left-to-right

Numerical Computation Review and Continuation CS-2301, B-Term Arithmetic Expressions with Multiple Operators pow(x,3) + 3*pow(x,2)*y + 3*x*pow(y,2) + pow(y,3) Highest – evaluate within () before anything else Low – look ahead to see if next operator is higher Medium – look ahead to see if next operator is lower

Numerical Computation Review and Continuation CS-2301, B-Term Warning Operator precedence does not specify order of evaluation of functions E.g., –x = f(arg1) + g(arg2); –f and g may be evaluated in either order! –arg1 and arg2 may be evaluated in either order Exceptions:– –&&, ||, ?:, and ',' Important if f and g have side effects

Numerical Computation Review and Continuation CS-2301, B-Term How does the compiler implement precedence? Answer:– using a data structure called a stack Definition:– Stack A linear data structure comprising a sequence of items, such that the last item added is the first item removed

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Detect constant token representing value 1 Place value 1 on value-location stack 1 values&locationsoperators

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover ‘ / ’ token Place on operator stack 1 values&locations / operators

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover ‘ ( ’ token –Start of a “sub expression” –Highest precedence of all Place matching ‘ ) ’ on operator stack 1 values&locations / operators ()

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover constant token 1 (again) Place on top of value- location stack 1 values&locations / operators ()1

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover ‘ / ’ token –Higher precedence than ‘ ( ’ Place ‘ / ’ on operator stack 1 values&locations / operators ()1 /

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover identifier token v1 Place on value- location stack 1 values&locations / operators ()1 /v1

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover token ‘ + ’ –Note that ‘ + ’ has lower precedence than ‘ / ’ –Cannot place it above ‘ / ’ Emit code to calculate 1/v1 –Consumes ‘ / ’ operator and top two values from stacks Place result on value- location stack Place on operator stack 1 values&locations / operators ()1 /v1

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Stacks now look like this 1 values&locations / operators ()1/v1 +

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover yet another value 1 –Place on stack 1 values&locations / operators ()1/v1 +1

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover yet another ‘ / ’ operator –Higher precedence than top of operator stack Place on operator stack 1 values&locations / operators ()1/v1 +1 /

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover yet another identifier v2 Place on value- location stack 1 values&locations / operators ()1/v1 +1 /v2

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover ‘ ) ’ token –Finish all operations back to ‘ ()’ 1 values&locations / operators ()1/v1 +1 /v2

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Emit code to do ‘ / ’ operation –Consumes top two values on the stack Places result on value location stack 1 values&locations / operators ()1/v1 +1 /v2

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Emit code for ‘ + ’ operation –Places result (i.e., sum ) on value location stack 1 values&locations / operators ()1/v1 +1/v2

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Delete ‘ () ’ 1 values&locations / operators ()sum

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Discover end of expression Emit code for ‘ / ’ operation Place result on value location stack 1 values&locations / operators sum

Numerical Computation Review and Continuation CS-2301, B-Term Understanding Operator Precedence Example:– 1/(1/v1 + 1/v2) ^ Final result is value of the expression 1/sum values&locationsoperators

Numerical Computation Review and Continuation CS-2301, B-Term Questions?