1. Introduction

One of the common requirements of the CPU is to be able to handle algebraic expressions such as

4(3-2)*(5+6)

We know that mathematical operators have precedence - they have an order. The brackets have to be evaluated first, then mulitply or divide and so on. Working with the example above we get :

4(1)*(11)

then deal with the left term we get:

4*11

Answer

44

This form of notation is called algebraic 'infix' notation.

But CPUs do not evaluate expressions in this way. They use the 'stack' data structure to evaluate expressions, and infix notation is not compatible with a stack and so another method must be found.

This mini-web will take you through how a CPU handles mathematical expressions.

 

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: infix algebraic notation

 

 

 

 

 

Copyright © www.teach-ict.com