[Last Call] Learn how to a build a cloud-first strategyRegister Now


Having trouble dealing with exponents with infix and postfix.

Posted on 2011-05-04
Medium Priority
Last Modified: 2012-05-11
So I understand that converting something like:
4 + 2 * 8 / 6 + 2
goes from left to right, so to get the postfix you throw parentheses in it based around the precedence from left to right:
( ( 4 + ( ( 2 * 8 ) / 6 ) ) + 2 )
then you get the postfix by going left to right and pulling the numbers and operators based on the right parentheses:

But what about for exponents?
does this go from right to left?
If so is this the only step thats different with exponents?
Then would you evaluate this the same you would with any postfix?

Then does the following evaluate to 49? For some reason I have 19 in my notes...
Question by:Eindoofus
  • 3
  • 2
LVL 32

Expert Comment

ID: 35689826
I use left to right associativity for exponents:
((3^2)^1) = 9

63(42^)*+5- = 63 16*+5- = 49

Author Comment

ID: 35689894
This follow is from:

Calculators may associate exponents to the left or to the right depending on the model. For example, the expression a ^ b ^ c on the TI-92 and TI-30XII (both Texas Instruments calculators) associates two different ways:
The TI-92 associates to the right, that is
a ^ b ^ c = a ^ (b ^ c) =  
whereas, the TI-30XII associates to the left, that is
a ^ b ^ c = (a ^ b) ^ c = (ab)c.

I could have sworn that in my class the professor said it was right to left. I don't understand how something like this has no definitive rule in mathematics?

LVL 32

Accepted Solution

phoffric earned 2000 total points
ID: 35689931
There are different standards in different countries. And Microsoft Windows XP calculator still says that  4+3*2 = 14, whereas from algebra throughout college, the answer has been 10.

Look up in your textbook what standard you are using.

Author Comment

ID: 35689978
So I take it that the standard only matters when going from infix to postfix?

With the following:
Is there anyway to get 19 out of that? The only thing I can pull from that is 49.
LVL 32

Expert Comment

ID: 35690070
Sorry, I haven't been able to come up with 19 yet.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Many of the most common information processing tasks require sorting data sets.  For example, you may want to find the largest or smallest value in a collection.  Or you may want to order the data set in numeric or alphabetical order. …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month18 days, 5 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question