Problem with parentheses in math operations
Dear Ludovic,
I found the following problem:
Having myself made a mistake, I investigated why the result of my operation was wrong and I believe that there is nonetheless also a bug in TTool with parentheses not being respected when doing calculations.
This is the original operation with values I was trying to compute. (My mistake being (dataRate/1000) = 0 since dataRate < 1000.)
enoughTime = (timeLeft - ((APDU.size + MPDUHeaderSize + PPDUHeaderSize)/(dataRate/1000))) enoughTime 881 timeLeft 900 APDU.size 50 MPDUHeaderSize 25 PPDUHeaderSize 6 dataRate 250
My first clue that something did not add up: I was getting test = 81 but if I tried to divide by zero I should get 2147483647 (done in another test).
test = ((APDU.size + MPDUHeaderSize + PPDUHeaderSize)/(dataRate/1000))) test 81
Thefore, I investigated previous code I had written that strangely worked when it should not have if parentheses were respected.
timeSending = PPDU.size/(dataRate/1000) PPDU.size 81 dataRate 250 timeSending 324
I also tried the following which clearly indicates it is not working.
enoughTime = (timeLeft - (1000*(APDU.size + MPDUHeaderSize + PPDUHeaderSize)/dataRate)) enoughTime -49131 It seems that it did 900 - (1000*50 + 25 + 6) (ignoring /datarate)
Sincerely,
Theau Heral
Submitted by external user theau.heral@student.isae-supaero.fr