flat assembler
Message board for the users of flat assembler.

Index > Heap > Simple math problem/question

Goto page 1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz
Hey everyone! I'm stuck on this example in math Very Happy can't figure out what's the result.. here it goes:
6:2(2+1)=?
Is that 1 or 9 ?
6:2*3=9
6: (2*3)=6:6=1
This stuck in my head, trying to solve but I have no idea what to do.. Thanks ))
Post 16 May 2011, 01:11
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
what to do?
that's just a getting used to count left to the right and nothing more
Code:
-> 6:2(2+1) = (6/2)*3
<- 6:2(2+1) = 6/(2*3)
    
Post 16 May 2011, 02:53
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Whoever started this shit, I want to find them, and murder them so gruesomely that the news of it spreads, to all who will ever possibly consider repeating the same(or similar) question, the answer to the question and the consequences of asking it.

http://www.physicsforums.com/showthread.php?t=494675
Post 16 May 2011, 03:13
View user's profile Send private message Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
Post 16 May 2011, 03:23
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
a guess both post should be joined
http://board.flatassembler.net/topic.php?t=12848

as it talks about the same.

bye the way, google calc resolves it preaty well.
Post 16 May 2011, 04:31
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz
I was thinking like that! First should be division because it's first and after that multiplication. it's 9! ))
Post 16 May 2011, 12:19
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
for me, 6/2(2+1)=1

because the math rules are strict.

6/2(3)
6/6
1

the other way to solve is illegal.

we can push the limit of error with more missconceptions like:

6/2(2+1)
3(3+1)
6+1
7

6/2(2+1)
6/2(2) + 6/2(1)
3(2) + 3(1)
6+3
9

lol;

the only solution is 1.


Description: here a simple calculator, only 2311 bytes for the calculator, the rest of the 50250 bytes is just what is supposed to be the system shared by all applications. :)
it is the very begining of this calcultor project.

Download
Filename: calculette.zip
Filesize: 17.14 KB
Downloaded: 102 Time(s)

Post 16 May 2011, 12:46
View user's profile Send private message Visit poster's website Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
Overflowz wrote:
I was thinking like that! First should be division because it's first and after that multiplication. it's 9! ))


are you shure its 9?

6:x(2+1) = 1


resolve X. should be x=2. or is it

6:x(2+1) = 9 ?

the problem with this, that its bad scripted, still you can get to the write result, but for the meter of fact, normaly:

x(2+1) = 2x + 1x = 3x.
so now its 6:3x and not 6:x3 where x=2.

becouse the brackets come before multiplication and division, and becouse of bad scripting, one try to first, resolve the brackets changing the order of precedence.



still the write result is 9, but of a metter of fact, its come becouse of bad writng, theres a tone of better ways to write this:

6 : 2 · (2+1) //this way the implied multiplication 2(2+1) is gone.

6
-- (2+1)
2
// the implied multiplication is still there, but its much more intuitive



efded
google for 6/2(2+1), or put it in your cientific calc, the result is 9, not 1.

the multiplication does not have priority above division, so you perform from left to write, fist division, then multiplication in this case.
Post 16 May 2011, 13:34
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
by the way

Code:
x equ  6/2*(2+1)

db   x+48  ;48 is for ascii transformation, I dont have a hex editor.
                
           
        
    


if you open it as text file, it display 9
Post 16 May 2011, 13:53
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
Quote:
efded
google for 6/2(2+1), or put it in your cientific calc, the result is 9, not 1.

the multiplication does not have priority above division, so you perform from left to write, fist division, then multiplication in this case.


don't rely on google for everything, as any trade mark shouldn't be believed because the principal actions from companies like this is to impose their vision without the agreement of the rest of the world.

my casio fx92 answers 1, it is logical.
the ti8x answer this too.

when i type 6/2(2+1), google answer (6/2)(2+1).
Post 16 May 2011, 14:06
View user's profile Send private message Visit poster's website Reply with quote
idle



Joined: 06 Jan 2011
Posts: 359
Location: Ukraine
idle
edfed
Code:
seg000:1011                 push    eax
seg000:1013                 push    ebx
seg000:1015                 mov     eax, [edi+4]
seg000:101A                 mov     ebx, [edi+8]
seg000:101F                 add     [esi+4], eax
seg000:1024                 add     [esi+8], ebx
seg000:1029                 pop     ebx
seg000:102B                 pop     eax
seg000:102D                 retn
seg000:102D sub_11011       endp
    

should not seg000:1024 be adc
Post 16 May 2011, 14:11
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
edfed wrote:
Quote:
efded
google for 6/2(2+1), or put it in your cientific calc, the result is 9, not 1.

the multiplication does not have priority above division, so you perform from left to write, fist division, then multiplication in this case.


don't rely on google for everything, as any trade mark shouldn't be believed because the principal actions from companies like this is to impose their vision without the agreement of the rest of the world.

my casio fx92 answers 1, it is logical.
the ti8x answer this too.

when i type 6/2(2+1), google answer (6/2)(2+1).


and what about this?

Code:
x equ  6/2*(2+1) 

db   x+48  ;48 is for ascii transformation, I dont have a hex editor.     


you are telling me that the fasm preprocesor is wrong?
Post 16 May 2011, 14:16
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
6/2(2+1) is not the same as 6/2*(2+1) for my calcultator too.

2(2+1) is interpreted as (2*(2+1))
2X cannot be cuted
2*X can
Post 16 May 2011, 15:07
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
idle wrote:
edfed
Code:
seg000:1011                 push    eax
seg000:1013                 push    ebx
seg000:1015                 mov     eax, [edi+4]
seg000:101A                 mov     ebx, [edi+8]
seg000:101F                 add     [esi+4], eax
seg000:1024                 add     [esi+8], ebx
seg000:1029                 pop     ebx
seg000:102B                 pop     eax
seg000:102D                 retn
seg000:102D sub_11011       endp
    

should not seg000:1024 be adc

not at all, this function have nothing to do with the calculator.

from memory, it is something like X,Y coordinates update in the system librairy.
Code:
                                                                addxy:
00000F11: 66 50 66 53                                                   push eax ebx
00000F15: 67 66 8B 47 04                                                mov eax,[edi+item.x]
00000F1A: 67 66 8B 5F 08                                                mov ebx,[edi+item.y]
00000F1F: 67 66 01 46 04                                                add [esi+item.x],eax
00000F24: 67 66 01 5E 08                                                add [esi+item.y],ebx
00000F29: 66 5B 66 58                                                   pop ebx eax
00000F2D: C3                                                            ret
    

and it is really time for fasmW to provide a "listing" button, just under the "build symbols" button in "run" menu. Very Happy

the calculator code starts a lot far away from the start of the total code.
Code:
0000BB43: 48 02 00 00 0A 00 00 00 0A 00 00 00 78 00 00 00               Gnode .x,.y,.xl,.yl,\
          1E 00 00 00 0C 00 00 00 2F BD 00 00 67 BC 00 00               clavier,\
          54 BA 00 00                                                   ecran,\
                                                                        grabber
    
Post 16 May 2011, 15:13
View user's profile Send private message Visit poster's website Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
http://epsstore.ti.com/OA_HTML/csksxvm.jsp?nSetId=103110

Quote:


Does implied multiplication and explicit multiplication have the same precedence on TI graphing calculators?

Implied multiplication has a higher priority than explicit multiplication to allow users to enter expressions, in the same manner as they would be written. For example, the TI-80, TI-81, TI-82, and TI-85 evaluate 1/2X as 1/(2*X), while other products may evaluate the same expression as 1/2*X from left to right. Without this feature, it would be necessary to group 2X in parentheses, something that is typically not done when writing the expression on paper.

This order of precedence was changed for the TI-83 family, TI-84 Plus family, TI-89 family, TI-92 Plus, Voyage™ 200 and the TI-Nspire™ Handheld in TI-84 Plus Mode. Implied and explicit multiplication is given the same priority.


As I understand, ther no such thing in math as "implied multiplication"
But it-s some how used in the calculators so you can easly input without using brackets

and if you read the full source, you can see that the same type of graphical calculator TEXAS some do first implied multiplication, other dont bother to note the diference.
Post 16 May 2011, 15:28
View user's profile Send private message Reply with quote
Overflowz



Joined: 03 Sep 2010
Posts: 1046
Overflowz
In my opinion:
6:2(2+1) = 6/2*3 = 3*3 = 9.
because of first action is division and second is multiplication. I think we need to re-learn Basic Math rules..
Post 16 May 2011, 18:56
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
Overflowz wrote:
In my opinion:
6:2(2+1) = 6/2*3 = 3*3 = 9.
because of first action is division and second is multiplication. I think we need to re-learn Basic Math rules..

not learn, but define. because it is a convention problem.

my casio returns 1 for 6/2(2+1)
and returns 9 for 6/2*(2+1), and i find it is logical as implied multiplication is apparented to an unbreakable link, exactlly as if there were parenthesis around its terms.
Post 16 May 2011, 18:59
View user's profile Send private message Visit poster's website Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
edfed wrote:
Overflowz wrote:
In my opinion:
6:2(2+1) = 6/2*3 = 3*3 = 9.
because of first action is division and second is multiplication. I think we need to re-learn Basic Math rules..

not learn, but define. because it is a convention problem.

my casio returns 1 for 6/2(2+1)
and returns 9 for 6/2*(2+1), and i find it is logical as implied multiplication is apparented to an unbreakable link, exactlly as if there were parenthesis around its terms.

As i posted alredy, in the graphic calculatores, some models, they first do implied multiplications to permit write formulas as you do on paper.

what I mean:

6/2(2+1), on paper should look like:
6
----------
2(2+1)

its done this way, so you shouldn-t use extra brackets in your calc.



so the thing is, you need to know how your calc is designed.
in hischool, I always wrote extra brackets on my calc, this way I avoid this nightmare.
(6/2)(2+1) or 6/(2(2+1))

its not math problem, but more like the scintific calculators notation simplification.


by the way, on paper, I dont remember using the / slash for division, only on the units, like km/h .
Normally, its used the ---- dash. like
6
--(2+1)
2
Post 16 May 2011, 19:41
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
What happened to PEMDAS ?
I see ppl going crazy ?

Can you all do this :

Given F: 2, X: 2
-----------------------------------------------------------
Simplify: F( POW(2,X) + SQRT(100) + XF )
Post 16 May 2011, 22:38
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
finally, it is not a so " Simple math problem/question".

i like this board.
Post 17 May 2011, 11:03
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.