Formula Square Root |
I have a questiona bout formulas, are they able to handle squareroots?
Re: Formula Square Root
Who needs a sqrt function? Just use ^ 0.5. The "^" operator is more versatile. 
Re: Formula Square Root
Sqrt has less order of operations issues.
SE5 doesn't always do order of operations like you'd expect (as SuicideJunkie found out: SE5 says that 100 - 100 + 5 - 5 DOESN'T equal 0..)
Re: Formula Square Root
SE5 doesn't always do order of operations like you'd expect (as SuicideJunkie found out: SE5 says that 100 - 100 + 5 - 5 DOESN'T equal 0..)That's why i use () a lot, that ensure operations are done in the right order...
Re: Formula Square Root
SE5 doesn't always do order of operations like you'd expect (as SuicideJunkie found out: SE5 says that 100 - 100 + 5 - 5 DOESN'T equal 0..)Huh? There's no way that that expression should be anything other than 0. Unless maybe you're referring to, say, "100 - 20 * 5" which should, if order of operations are followed successfully, equal 0.
Re: Formula Square Root
SE5 is funky, i believe it does (100 - (100 + 5)) - 5 or something like that...
Re: Formula Square Root
Which should STILL equal 0, but go figure it doesn't.
Ah, here's the actual comment:
Requirement 1 Description := This game thinks "100 + 5 - 5 - 100 = 0" is False Requirement 1 Formula := 100 + 5 - 5 - 100 = 0
Its worth noting that you can fix this particular problem by enclosing the part before the = sign in parenthesis.
So, in SE5 terms:
100 + 5 - 5 - 100 != 0
but
(100 + 5 - 5 - 100) = 0
Re: Formula Square Root
Interesting. Could the = sign be given higher priority than the + or - symbols? (That is, the game does a 100 = 0 check first).
I can't remember what "TRUE" and "FALSE" are, integer wise, but they may have something to do with it.
That is, the game could be trying this: 100 + 5 - 5 - (100 = 0), which assume FALSE = 0, would result in a value of 100.
Re: Formula Square Root
Actually, if you do ((100 - (100 + 5)) - 5, the result is -10, not 0.




Re: Formula Square Root
If you look in Docs\SE5_Modding.pdf, you will see that the answer is yes: Sqrt()