Urgent Variable overflow in calculation

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

Flowcode v10 Urgent Variable overflow in calculation

Post by Xbiotec »

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 236 times
May be I did something wrong !
Thx for your prompt help
Seb

Steve-Matrix
Matrix Staff
Posts: 1384
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 184 times
Been thanked: 322 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.

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: Urgent Variable overflow in calculation

Post by Xbiotec »

this work

Code: Select all

Max_Flow_Time = Max_Flow_Const
Max_Flow_Time = Max_Flow_Var * Max_Flow_Time
thx
Seb

Xbiotec
Posts: 200
Joined: Thu Sep 23, 2021 3:44 pm
Location: France
Has thanked: 32 times
Been thanked: 24 times

Re: Urgent Variable overflow in calculation

Post by Xbiotec »

Max_Flow_Var also ULONG instead of a BYTE also not working
Seb

Post Reply