Urgent Variable overflow in calculation

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
lucibel
Posts: 172
http://meble-kuchenne.info.pl
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 29 times
Been thanked: 22 times

Flowcode v10 Urgent Variable overflow in calculation

Post by lucibel »

Hi,
I need help to solve this problem ASAP
it seems that there is overflow of the variable when make this calculation
51569*2=37602 instead of 103138
I think it's overflow because 103138-65536=37602
But the calculation result is store in ULong variable
Test Flowcode1.fcfx
(14.32 KiB) Downloaded 147 times
May be I did something wrong !
Thx for your prompt help
Seb

Steve-Matrix
Matrix Staff
Posts: 1253
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 167 times
Been thanked: 277 times

Re: Urgent Variable overflow in calculation

Post by Steve-Matrix »

What if you do the following in a calculation icon?

Code: Select all

Max_Flow_Time = Max_Flow_Const
Max_Flow_Time = Max_Flow_Var * Max_Flow_Time
Or alternatively, you could try making the Max_Flow_Var also ULONG instead of a BYTE.

Both of these should force the compiler to perform the calculation without truncating to a UINT.

lucibel
Posts: 172
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 29 times
Been thanked: 22 times

Re: Urgent Variable overflow in calculation

Post by lucibel »

this work

Code: Select all

Max_Flow_Time = Max_Flow_Const
Max_Flow_Time = Max_Flow_Var * Max_Flow_Time
thx
Seb

lucibel
Posts: 172
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 29 times
Been thanked: 22 times

Re: Urgent Variable overflow in calculation

Post by lucibel »

Max_Flow_Var also ULONG instead of a BYTE also not working
Seb

Post Reply