LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Operator Precedence


@RTSLVU wrote:

@aputman wrote:

I'd be interested to see any calculator that interprets 1+2*8-6 as 1+(2*8)-6.  Calculators solve equations in the order they are input unless you have the ability to enter parentheses into the calculation.  IMHO, it's not a good calculator if it makes assumptions about what the operator wants, rather than doing what the operator says. 


aputman is correct here. 

 

If I enter 1+2*8-6 im my calculator it responds like this:

 

I enter 1+2 as soon as I hit * the calculator shows the answer for 1+2 (3)

 

I hit the 8 and the calculator shows 24

 

Finish with - 6 and the answer is 18

 


Can you show us a picture of your calculator?  Give us a make or model number?  It sounds like a cheap one.

 

Here is the calculator I bought back in 1986.  http://www.datamath.org/Sci/Slimline/TI-30SLR.htm  It used normal math order of operations.

0 Kudos
Message 11 of 20
(1,729 Views)

@RavensFan wrote:

@RTSLVU wrote:

@aputman wrote:

I'd be interested to see any calculator that interprets 1+2*8-6 as 1+(2*8)-6.  Calculators solve equations in the order they are input unless you have the ability to enter parentheses into the calculation.  IMHO, it's not a good calculator if it makes assumptions about what the operator wants, rather than doing what the operator says. 


aputman is correct here. 

 

If I enter 1+2*8-6 im my calculator it responds like this:

 

I enter 1+2 as soon as I hit * the calculator shows the answer for 1+2 (3)

 

I hit the 8 and the calculator shows 24

 

Finish with - 6 and the answer is 18

 


Can you show us a picture of your calculator?  Give us a make or model number?  It sounds like a cheap one.

 

Here is the calculator I bought back in 1986.  http://www.datamath.org/Sci/Slimline/TI-30SLR.htm  It used normal math order of operations.


Here you go:

C1.PNG c2.PNG

 

Intresting to note if I place it in "Scientific" mode it solves it the way you would think 1+(2*8)-6

========================
=== Engineer Ambiguously ===
========================
Message 12 of 20
(1,725 Views)

To answer the original question, assuming the OP is actually trying to use the Evaluate Formula String function.  It uses normal mat order of operations.

 

Message 13 of 20
(1,723 Views)

@RTSLVU wrote:


Here you go:

C1.PNG c2.PNG

 

Intresting to note if I place it in "Scientific" mode it solves it the way you would think 1+(2*8)-6


I didn't even realize anyone was talking about the Windows calculator.  I thought we were talking about physical calculators.

 

That is interesting that MS decided to program the behavior of the cheap calculators into its calculator program in the "standard" view of the calculator, and the behavior of good, scientific calculators int the "scientific" view.

0 Kudos
Message 14 of 20
(1,718 Views)

@RavensFan wrote:

Here is the calculator I bought back in 1986.  http://www.datamath.org/Sci/Slimline/TI-30SLR.htm  It used normal math order of operations.


Correction to the link (you had a couple of extra unprintable characters that messed it up): http://www.datamath.org/Sci/Slimline/TI-30SLR.htm

 

I had to use a TI-30XA in college due to a professor not wanting us to use "programmable" calculators.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 20
(1,714 Views)

@RavensFan wrote:

I didn't even realize anyone was talking about the Windows calculator.  I thought we were talking about physical calculators.

 

That is interesting that MS decided to program the behavior of the cheap calculators into its calculator program in the "standard" view of the calculator, and the behavior of good, scientific calculators int the "scientific" view.


Well it's the only calculator I have anymore...

 

But yeah, who knows why MS did this. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 16 of 20
(1,710 Views)

@RTSLVU wrote:

But yeah, who knows why MS did this. 


Because that is what the large majority of people expect.  That is also why MS added a "Scientic" and "Programmer" mode to the calculator for people like us.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 17 of 20
(1,704 Views)

@RavensFan wrote:
 I thought we were talking about physical calculators.

 

That is interesting that MS decided to program the behavior of the cheap calculators into its calculator program in the "standard" view of the calculator, and the behavior of good, scientific calculators int the "scientific" view.


There is still a good number of cheap calculators out there, incl. the old mechanical ones, which work like the "standard" one. I agree it should be better named "old/direct" or similar.

I noticed the difference some 5 years ago when i got some strange results. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 18 of 20
(1,686 Views)

I'm not saying there aren't plenty of cheap calculators out there that do it in the order of entry.  I was replying to Aputman's earlier comment in message #7 that he hadn't seen a calculator do it in normal math order of operations, and even went to so far to suggest that such a calculator was wrong.  I would think anyone participating in these forums would have a technical background and would be quite familiar with the existence of scientific calculators.

0 Kudos
Message 19 of 20
(1,672 Views)

@RavensFan wrote:

 I would think anyone participating in these forums would have a technical background and would be quite familiar with the existence of scientific calculators.


I would think anyone participating in these forums wouldn't have a "holier than thou" attitude that pisses everyone off but thanks for the clarification.  I never knew a calculator would do that and obviously there are other technically minded people here that didn't realize it either.  

aputman
0 Kudos
Message 20 of 20
(1,654 Views)