- Joined
- Nov 2, 2004
- Messages
- 1,993
Could someone explain this to me?
It's been a real headache even figuring out this is what's going wrong, it makes absolutely no sense to me.
Edit:I just tested in a separate trigger and it's not happening there. No idea what's going on.
Edit2: updated the code above. Thesubtraction of 0.1 is somehow being repeated by putting the variable through R2I 
Edit3: I guess real subtraction is just horribly imprecise in JASS... probably instead of -0.1 it does -0.1000001 or something.
Either that or the R2I function isn't very good.
JASS:
set udg_PatrolSystemState = 1.1
call BJDebugMsg(R2S(udg_PatrolSystemState)) // 1.100
set udg_PatrolSystemState = udg_PatrolSystemState-0.1
call BJDebugMsg(R2S(udg_PatrolSystemState*10)) // 10.000
call BJDebugMsg(I2S(R2I(udg_PatrolSystemState*10))) // 9 <== WTF?
It's been a real headache even figuring out this is what's going wrong, it makes absolutely no sense to me.
Edit:
Edit2: updated the code above. The
Edit3: I guess real subtraction is just horribly imprecise in JASS... probably instead of -0.1 it does -0.1000001 or something.
Either that or the R2I function isn't very good.
JASS:
set udg_PatrolSystemState = 1.1
call BJDebugMsg(R2S(udg_PatrolSystemState*10)) // 11.000
set udg_PatrolSystemState = udg_PatrolSystemState-0.3
call BJDebugMsg(R2S(udg_PatrolSystemState*10)) // 8.000
call BJDebugMsg(I2S(R2I(udg_PatrolSystemState*10))) // 7 <== WTF?
set udg_PatrolSystemState = 0.8
call BJDebugMsg(I2S(R2I(udg_PatrolSystemState*10))) // 8
Last edited: