well, the order is left to right, but it is just a logical guess because actually:
doing : a/b*c/d*e-f
if you do ((((a/b)*c)/d)*e)-f the result will be same as:
if you do (a/b)*(c/d)*e-f
actually i will check if a+b/c-d*e/f
normally / and * should come before + and -
so it should go (a+(b/c)-(d*e))/f
unless you do in math (((a+b)/(c-d))*e)/f
but i wonder if Jass access () to make math priority ?
[Jass=]
//! runtextmacro variables()
// This is where you should delcare your variables
// Remember, (type) (name)
// Assignment sector:
integer a
integer b
integer c
integer d
integer e
integer f
real g
real h
real ab
real cd
//! runtextmacro endvariables()
//! runtextmacro actions()
// This is where you should put all the code that modifies
// and plays with the variables you declared above.
set a = 6
set b = 5
set c = 4
set d = 3
set e = 2
set f = 1
set ab = 6./5
set cd = 4./3
set g = a/b*c/d*e-f
set h = ab*cd*e-f
// Assignment sector:
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + I2S(R2I(a/b*c/d*e-f)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + R2S(g))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, R2S(ab)+"X "+ R2S(cd)+"X 2 - 1 = "+ R2S(h))
//! runtextmacro endactions()[/code]
one result show 1.00 but it is just a bug because integer divide into integer only, the other result using real is correct result.
second test using a+b/c-d*e/f
[Jass=]//! runtextmacro variables()
// This is where you should delcare your variables
// Remember, (type) (name)
// Assignment sector:
real a
real b
real c
real d
real e
real f
real g
real h
real ab
real cd
//! runtextmacro endvariables()
//! runtextmacro actions()
// This is where you should put all the code that modifies
// and plays with the variables you declared above.
set a = 6.
set b = 5.
set c = 4.
set d = 3.
set e = 2.
set f = 1.
set ab = 6.+5
set cd = 4.-3
set g = a+b/c-d*e/f
set h = ab/cd*e-f
// Assignment sector:
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + R2S(a+b/c-d*e/f))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + R2S(g))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, R2S(ab)+"X "+ R2S(cd)+"X 2 - 1 = "+ R2S(h))
//! runtextmacro endactions()[/code]
result is 1.25 and 22
wich mean Jass make operation in order from left to right
doing : a/b*c/d*e-f
if you do ((((a/b)*c)/d)*e)-f the result will be same as:
if you do (a/b)*(c/d)*e-f
actually i will check if a+b/c-d*e/f
normally / and * should come before + and -
so it should go (a+(b/c)-(d*e))/f
unless you do in math (((a+b)/(c-d))*e)/f
but i wonder if Jass access () to make math priority ?
[Jass=]
//! runtextmacro variables()
// This is where you should delcare your variables
// Remember, (type) (name)
// Assignment sector:
integer a
integer b
integer c
integer d
integer e
integer f
real g
real h
real ab
real cd
//! runtextmacro endvariables()
//! runtextmacro actions()
// This is where you should put all the code that modifies
// and plays with the variables you declared above.
set a = 6
set b = 5
set c = 4
set d = 3
set e = 2
set f = 1
set ab = 6./5
set cd = 4./3
set g = a/b*c/d*e-f
set h = ab*cd*e-f
// Assignment sector:
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + I2S(R2I(a/b*c/d*e-f)))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + R2S(g))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, R2S(ab)+"X "+ R2S(cd)+"X 2 - 1 = "+ R2S(h))
//! runtextmacro endactions()[/code]
one result show 1.00 but it is just a bug because integer divide into integer only, the other result using real is correct result.
second test using a+b/c-d*e/f
[Jass=]//! runtextmacro variables()
// This is where you should delcare your variables
// Remember, (type) (name)
// Assignment sector:
real a
real b
real c
real d
real e
real f
real g
real h
real ab
real cd
//! runtextmacro endvariables()
//! runtextmacro actions()
// This is where you should put all the code that modifies
// and plays with the variables you declared above.
set a = 6.
set b = 5.
set c = 4.
set d = 3.
set e = 2.
set f = 1.
set ab = 6.+5
set cd = 4.-3
set g = a+b/c-d*e/f
set h = ab/cd*e-f
// Assignment sector:
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + R2S(a+b/c-d*e/f))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, "total is " + R2S(g))
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60, R2S(ab)+"X "+ R2S(cd)+"X 2 - 1 = "+ R2S(h))
//! runtextmacro endactions()[/code]
result is 1.25 and 22
wich mean Jass make operation in order from left to right