$calc(2^2) == INCORRECT
#112756
26/02/05 12:53 PM

Joined: Feb 2003
Posts: 2,680
Raccoon
OP
Hoopy frood

OP
Hoopy frood
Joined: Feb 2003
Posts: 2,680 
Fundimental flaw in the order of operations that $calc uses. When a negative interger is raised to a power without being enclosed in paranthasies, order of operations state that the exponent is calculated first and THEN the negative sign is applied. $calc((2^2)) == 4$calc((2)^2) == 4$calc(2^2) == 4The order of operations in 2^2 should be equivilent to (2^2) and NOT (2)^2. Enjoy!
Well. At least I won lunch. Good philosophy, see good in bad, I like!



Re: $calc(2^2) == INCORRECT
#112757
26/02/05 05:55 PM

Joined: Sep 2004
Posts: 18
Erik_The_Red
Pikka bird

Pikka bird
Joined: Sep 2004
Posts: 18 
I see correct the three answers. 2² = 4



Re: $calc(2^2) == INCORRECT
#112758
26/02/05 07:54 PM

Joined: Apr 2003
Posts: 701
Kelder
Hoopy frood

Hoopy frood
Joined: Apr 2003
Posts: 701 
$calc(02^2) == 4
Unary  is higher than exponent in a lot of programming languages, doesn't seem that strange that mIRC chooses to follow that...



Re: $calc(2^2) == INCORRECT
#112759
26/02/05 08:30 PM

Joined: Sep 2004
Posts: 18
Erik_The_Red
Pikka bird

Pikka bird
Joined: Sep 2004
Posts: 18 
$calc(2^2) = 2² = 4 $calc(2*2) = 2² = 4
Where it is the error?



Re: $calc(2^2) == INCORRECT
#112760
26/02/05 08:53 PM

Joined: Mar 2004
Posts: 457
Danthemandoo
Fjord artisan

Fjord artisan
Joined: Mar 2004
Posts: 457 
according to my casio calculator 2² equals 4. So casio is wrong?
[Edit] above is not meant to sound sarcastic btw, its a serious question
Last edited by Danthemandoo; 26/02/05 09:00 PM.



Re: $calc(2^2) == INCORRECT
#112761
26/02/05 09:05 PM

Joined: Jan 2003
Posts: 2,523
qwerty
Hoopy frood

Hoopy frood
Joined: Jan 2003
Posts: 2,523 
The order of operations does indeed state that exponent precedes subtraction. The negative sign there isn't an operation though (or at least that's how I understand it); it's part of the number, a symbol to denote that this number is negative.
What's more convincing than my speculations though is Microsoft's PowerToy Calc and Google. If you enter the expression "2^2" in either of them, you get 4.
I searched Google for info on this but I found mixed answers, unfortunately not from reliable scientific sources.
/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com



Re: $calc(2^2) == INCORRECT
#112762
26/02/05 09:27 PM

Joined: Sep 2003
Posts: 4,230
DaveC
Hoopy frood

Hoopy frood
Joined: Sep 2003
Posts: 4,230 
Your calculator has flat batteries maybe Im getting 4 on both my casios (fx602p, fx82super) What did you type? [2] [+/] [X²] result 4 [2] [X²] [+/] result 4 Any negitive number squared makes a positive number and 2 is a negitive number last time i checked (which was a while ago so maybe they changed the rules of math lately?)



Re: $calc(2^2) == INCORRECT
#112763
26/02/05 10:14 PM

Joined: Feb 2003
Posts: 2,680
Raccoon
OP
Hoopy frood

OP
Hoopy frood
Joined: Feb 2003
Posts: 2,680 
To DaveC: Your calculator has flat batteries maybe Im getting 4 on both my casios (fx602p, fx82super) If your Casio calculator is capable of multitermed equasions, then you should have gotten 4. To Everyone Else: According to my TI85: According to Javascript:  <a href="javascript:alert(2^2);" target="_blank">javascript:alert(2^2);</a> < click
According to MATLAB 6.5: According to Python 2.3.4: According to "Beginning & Intermediate Algebra (3rd Ed)" by K. MartinGay (ISBN 0131444425)  1.4 Calculator Explorations, Order of Operations (p.30):
Some calculators follow the order of operations, and others do not. To see whether or not your calculator has the order of operations built in, use your calculator to find 2 + 3 · 4. To do this, press the following sequence of keys: [2] [+] [3] [x] [4] [=] (or [enter]). The correct answer will be 14 because the order of operations is to multiply before we add.
I'm guessing your Casio does not support order of operations.
5.1 Exponents (p.288): As we reviewed in Section 1.4, an exponent is a shorthand notation for repeated factors. For example, 2 · 2 · 2 · 2 · 2 can be written as 2^5. The expression 2^5 is called an exponential expression. It is also called the fifth power of 2, or we say that 2 is raised to the fifth power. The base of an exponential expression is the repeated factor. The exponent is the number of times that the base is used as a factor.
Example: c. (4)² = (4) (4) = 16 d. 4² = (4 · 4) = 16
Notice how similar 4² is to (4)² in the example above. The difference between the two is the parentheses. In (4)², the parentheses tell us that the base, or repeated factor, is 4. In 4², only 4 is the base.
Helpful Hint: Be careful when identifying the base of an exponential expression. Pay close attention to the use of parentheses.
In (3)² the base is 3. (3)² = (3) (3) = 9 In 3² the base is 3. 3² = (3 · 3) = 9 In 2 · 3² the base is 3. 2 · 3² = 2 · 3 · 3 = 18
I hope this helps clear any confusion.  Raccoon
Last edited by Raccoon; 27/02/05 12:02 AM.



Re: $calc(2^2) == INCORRECT
#112764
26/02/05 10:46 PM

Joined: Mar 2004
Posts: 457
Danthemandoo
Fjord artisan

Fjord artisan
Joined: Mar 2004
Posts: 457 
its a fx83WA according to the top, and i typed: [()] [2] [x²] and it spat out 4 But technically 2² is 2 * 2 which equals 4, but (2)² is 4..eerr. oh sod it i give up i was never any good at maths anyway
Last edited by Danthemandoo; 26/02/05 10:48 PM.



Re: $calc(2^2) == INCORRECT
#112765
26/02/05 11:15 PM

Joined: Feb 2004
Posts: 206
Darwin_Koala
Fjord artisan

Fjord artisan
Joined: Feb 2004
Posts: 206 
Having read this thread and seeing the various arguments for and against  here is an answer that should finalise this.
Regardless of everyone's ability or inability to operate their $5 calculator properly (that's an argument for another day!)
2^2 , as written, is interpreted as (2) ^ 2. The correct answer is 4.
That is not my opinion, that is fact. Clear as day, no argument. in this case (2) is a number, just as 2 is.
Any debate on the correctness of it is not a debate of the maths, but of proponents ability to enter equations into their preferred mathematical software, or the ability of the software to interpret that equation.
Of course, if you enter (2^2) , then +/ you are going to get the answer (negative four).
And yes, 02^2 will be interpreted as "0 minus two squared", the correct answer will be "negative four". In this case, the "" indicates "subtract", and the numbers in the equation are 0, 2 and 2.
However, the previous two equations are not equivalent to "2^2".
The bottom line: there is no bug here.
Cheers, and yours in mathematica,
DK
Darwin_Koala
Junior Brat, Innocent(r)(tm) and original source of DKitis!



Re: $calc(2^2) == INCORRECT
#112766
26/02/05 11:27 PM

Joined: Feb 2004
Posts: 206
Darwin_Koala
Fjord artisan

Fjord artisan
Joined: Feb 2004
Posts: 206 
according to my casio calculator 2² equals 4. So casio is wrong?
[Edit] above is not meant to sound sarcastic btw, its a serious question Try typing "2+3*4" into your calculator. The correct answer is "14", but the elCheapo calculators (the "$5 ones" in my previous response) will give an answer of "20". To answer your question, yes, your casio can be wrong. Having said that the Calculator can be "wrong", it is up to us as users of the tool to be aware of the limitations. In this case, we need to put ()'s in the right places to get the right answers. Of course, the stronger solution is a consumer boycott of cruddy products that don't give right answers! BTW, some of the software solutions (I can think of a "scientific calculator" in Linux that fits in this category) are just as bad. Usually the simple "2+3*4" test will find them out. Cheers, DK p.s. given that order of operations is usch an important part of maths, why is it so hard for calculator programmers to get such an easy thing right?
Darwin_Koala
Junior Brat, Innocent(r)(tm) and original source of DKitis!



Re: $calc(2^2) == INCORRECT
#112767
26/02/05 11:33 PM

Joined: Feb 2003
Posts: 2,680
Raccoon
OP
Hoopy frood

OP
Hoopy frood
Joined: Feb 2003
Posts: 2,680 
Edited my post above.
Included picture of my TI85. Included output from 3 programming languages (Javascript, Python and MATLAB). Included verbatim source from college algebra book.
Does anyone here have MAPLE they can try this on?
Would someone try debug.print 2^2 in Visual Basic aswell?
Well. At least I won lunch. Good philosophy, see good in bad, I like!



Re: $calc(2^2) == INCORRECT
#112768
26/02/05 11:39 PM

Joined: Feb 2003
Posts: 2,680
Raccoon
OP
Hoopy frood

OP
Hoopy frood
Joined: Feb 2003
Posts: 2,680 
Regardless of everyone's ability or inability to operate their $5 calculator properly (that's an argument for another day!)
2^2 , as written, is interpreted as (2) ^ 2. The correct answer is 4.
That is not my opinion, that is fact. Clear as day, no argument. in this case (2) is a number, just as 2 is. You are incorrect sir. Please see me after class.
Well. At least I won lunch. Good philosophy, see good in bad, I like!



Re: $calc(2^2) == INCORRECT
#112769
27/02/05 12:10 AM

Joined: Oct 2003
Posts: 3,918
argv0
Hoopy frood

Hoopy frood
Joined: Oct 2003
Posts: 3,918 
2^2 , as written, is interpreted as (2) ^ 2. The correct answer is 4.
Since when is 2^2 interpreted as (2)^2 ? You realize you just stuck in a bracket into the equation..thereby explicitly changing the equation. So if 2^2 were to be interpreted as (2)^2 then it would have been expressed as (2)^2. Therefore it's logically impossible for 2^2 to be interpreted as (2)^2 because then 2^2 would not exist. You also realize that you must be explicit about your expressions in both computing and mathematics; and if you haven't realized this yet then i (a) don't know how you managed to pass any math tests past gr.6 in your life and (b) don't know how you're able to use a computer properly. You don't tell a computer to perform 2^2 and then say 'Oh but i meant (2)^2'. According to order of operation rules that EVERY mathematician follows, exponents are second in line after brackets. 2 is 02. This is all stuff you learn in basic math courses in the early high school years. That being said, 2^2 MEANS 0  2^2. If you don't agree, then YOU're wrong.
 argv[0] on EFnet #mIRC  "Life is a pointer to an integer without a cast"



Re: $calc(2^2) == INCORRECT
#112770
27/02/05 12:11 AM

Joined: Oct 2003
Posts: 14
qFox
Pikka bird

Pikka bird
Joined: Oct 2003
Posts: 14 
Prelude> 2^2 (4) This be Haskell



Re: $calc(2^2) == INCORRECT
#112771
27/02/05 12:14 AM

Joined: Oct 2003
Posts: 3,918
argv0
Hoopy frood

Hoopy frood
Joined: Oct 2003
Posts: 3,918 
(19:11:12) <Sais> perl wle 'print 2**2;'
(19:11:13) <Sais> 4
I wonder how much more proof is needed. I was sold on the theory alone, personally *shrugs*
 argv[0] on EFnet #mIRC  "Life is a pointer to an integer without a cast"



Re: $calc(2^2) == INCORRECT
#112772
27/02/05 12:18 AM

Joined: Oct 2003
Posts: 14
qFox
Pikka bird

Pikka bird
Joined: Oct 2003
Posts: 14 
prolog:
test(X) : X is 2^2.
1 ? test(X).
X = 4
but i would not put my faith in prolog's parser, or math capabilities for that matter.



Re: $calc(2^2) == INCORRECT
#112773
27/02/05 12:20 AM

Joined: Oct 2003
Posts: 3,918
argv0
Hoopy frood

Hoopy frood
Joined: Oct 2003
Posts: 3,918 
Sub Main()
Console.Out.WriteLine(2 ^ 2)
End Sub
4. "if MS follows a standard..then it has to be worthy of following"
 argv[0] on EFnet #mIRC  "Life is a pointer to an integer without a cast"



Re: $calc(2^2) == INCORRECT
#112774
27/02/05 12:24 AM

Joined: Sep 2003
Posts: 4,230
DaveC
Hoopy frood

Hoopy frood
Joined: Sep 2003
Posts: 4,230 
its a fx83WA : [()] [2] [x²] and it spat out 4
I dont have a () button, and if i used the +/i button when its zero it just stays zero, want negate the number. what do you get if you go [()] [2] [x] [x] [=] ? Sounds like a accountants calculator, no matter what you put in the result well be what he wants out.



Re: $calc(2^2) == INCORRECT
#112775
27/02/05 12:29 AM

Joined: Oct 2003
Posts: 3,918
argv0
Hoopy frood

Hoopy frood
Joined: Oct 2003
Posts: 3,918 
Unary  is higher than exponent in a lot of programming languages, So far i haven't seen one language that follows this rule. Maybe someone can try FORTRAN/ Pascal ? ...Java? unless by 'lots of programming languages' you mean one or two obscure languages, then i have to disagree
 argv[0] on EFnet #mIRC  "Life is a pointer to an integer without a cast"




