So, alot of people "know" that a real of 5.00 sometimes converted to integer would give a integer of 4.. (and the same for other "whole" reals aswell)
Now, I *could* buy the ordinary explanation (the reals sometimes are 4.9999 or 5.0001 instead of 5), except for one thing; I had a number that in ordinary cases was 1.00 (or 100%) that affected another number. However, when 0.05 (5%) was added and removed the affected number decreases as well as the integer-conversion of the modifier. I needed to doublecheck that the decrease was a 1-time thing only (thereby fixing it by increasing the 1.00 to 1.0001 or something). But my tests indicate that it was a lowering of the amount every time.. Here is a small report, if any1 has more information of the subject, please feel free to add.
Theory: A addition and subtraktion with the same real with digits of a real variable seems to actually lower the variable when it should have been returned to the same.
Test1: To quickly see if it works like that, I created a simple loop running through 300 times that adds and removes the same amount from a global real variable. A bjdebugmsg with the real*10000 (to see otherwise "hidden" digits) is called before and after the loop. Code:
To test if this is the way in non-loops, I tried the samething without loops, and it still decreases every time it is tested, but with lower speed (the loop generated about a minus of 3.5*10^-4 in the loop, the unlooped version had a to low number to get any good approx-number at all, but it seemed to be a little below 1.5*10^-5.
A testmap is attached. (:
Now, I *could* buy the ordinary explanation (the reals sometimes are 4.9999 or 5.0001 instead of 5), except for one thing; I had a number that in ordinary cases was 1.00 (or 100%) that affected another number. However, when 0.05 (5%) was added and removed the affected number decreases as well as the integer-conversion of the modifier. I needed to doublecheck that the decrease was a 1-time thing only (thereby fixing it by increasing the 1.00 to 1.0001 or something). But my tests indicate that it was a lowering of the amount every time.. Here is a small report, if any1 has more information of the subject, please feel free to add.
Theory: A addition and subtraktion with the same real with digits of a real variable seems to actually lower the variable when it should have been returned to the same.
Test1: To quickly see if it works like that, I created a simple loop running through 300 times that adds and removes the same amount from a global real variable. A bjdebugmsg with the real*10000 (to see otherwise "hidden" digits) is called before and after the loop. Code:
globals
real testnumber = 1.00
constant real TNA = 0.05
endglobals
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local integer i = 0
call BJDebugMsg("R2I: " + I2S(R2I(testnumber)) + " and R * 10000: " + R2S(testnumber*10000))
loop
exitwhen i > 300
set testnumber = testnumber + TNA
set testnumber = testnumber - TNA
set i = i + 1
endloop
call BJDebugMsg("R2I: " + I2S(R2I(testnumber)) + " and R * 10000: " + R2S(testnumber*10000))
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
call TriggerRegisterPlayerChatEvent(gg_trg_Untitled_Trigger_001, Player(0), "-test", true)
endfunction
To test if this is the way in non-loops, I tried the samething without loops, and it still decreases every time it is tested, but with lower speed (the loop generated about a minus of 3.5*10^-4 in the loop, the unlooped version had a to low number to get any good approx-number at all, but it seemed to be a little below 1.5*10^-5.
A testmap is attached. (: