Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Tech Support (https://forums.graalonline.com/forums/forumdisplay.php?f=7)
-   -   Operator Precedence (https://forums.graalonline.com/forums/showthread.php?t=63333)

jake13jake 01-10-2006 07:17 AM

Operator Precedence
 
I'm makeing a jump function, and this precedence of operators is really screwing me up.
2*(dy-v*t)/t^2 != 2*(dy-v*t)/(t^2)

Shouldn'y the ^ operator have a higher precedence than all of the other operators?

Rick 01-10-2006 07:51 AM

No, even in C it isn't.

jake13jake 01-10-2006 08:10 AM

Quote:

Originally Posted by Rick
No, even in C it isn't.

Uhhh... isn't it the xor operator in C? In math operations it should hold higher precedence than /* and lower than ()

napo_p2p 01-10-2006 08:37 AM

What's so bad about adding the () anyway?

jake13jake 01-10-2006 09:45 AM

Quote:

Originally Posted by napo_p2p
What's so bad about adding the () anyway?

It's not so bad about adding parenthesis, but it's disgusting that it contradicts the universal standard mathematical order of operations.

napo_p2p 01-10-2006 09:57 AM

Quote:

Originally Posted by jake13jake
It's not so bad about adding parenthesis, but it's disgusting that it contradicts the universal standard mathematical order of operations.

I see where you are coming from but...

Quote:

Originally Posted by jake13jake
I'm makeing a jump function, and this precedence of operators is really screwing me up.

That made it seem like this "operator precedence problem" was keeping you from making your script.

jake13jake 01-10-2006 10:31 AM

Quote:

Originally Posted by napo_p2p
I see where you are coming from but...



That made it seem like this "operator precedence problem" was keeping you from making your script.

Seriously, I spent too much time the last three days rewriting the position equation in my notebook and solving for acceleration, trying to figure out what was wrong with it when the problem preventing me from moving forward was this operator precedence problem.

Admins 01-10-2006 04:35 PM

I recommend adding brackets whenever you are unsure about the results, since there are a lot of operators in Graal. But it is true that the order of operations is not correct, it is treating multiplication and division with the same priority as exponents, while exponents should be calculated first, like in v2.
I have fixed it, the npcservers need to be restarted.

jake13jake 01-11-2006 01:31 AM

Quote:

Originally Posted by Stefan
I recommend adding brackets whenever you are unsure about the results, since there are a lot of operators in Graal. But it is true that the order of operations is not correct, it is treating multiplication and division with the same priority as exponents, while exponents should be calculated first, like in v2.
I have fixed it, the npcservers need to be restarted.

I never have had a problem with the math order of operations, but sometimes with the conditionals... which i would use parenthesis anyways.


All times are GMT +2. The time now is 08:46 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.