FLOAT variable not working?

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
imtiaz9
Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Contact:

FLOAT variable not working?

Post by imtiaz9 »

Float variable is not working properly. the calculation say answer of 65000/1020= 63.7254 but variable show only 63.0000
Attachments
Flowcode1.fcf
(5.5 KiB) Downloaded 103 times

User avatar
LeighM
Matrix Staff
Posts: 2043
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: FLOAT variable not working?

Post by LeighM »

Hi,
That's because TOTAL and ADC are integers, not floats, hence TOTAL/ADC is still an integer, which gets converted to a float value.
You need to make TOTAL and ADC float variables.

Halcon0653
Posts: 8
Joined: Sun Apr 21, 2019 5:16 pm
Contact:

Re: FLOAT variable not working?

Post by Halcon0653 »

Thanks!,
Same problem, same solution for me years later...

User avatar
Benj
Matrix Staff
Posts: 14837
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: FLOAT variable not working?

Post by Benj »

Try this instead and you should get the right result.

65000.0/1020.0

Adding the decimal point forces the values to be floats and hence use the floating point maths library. Otherwise you will be using the integer maths library for speed and efficiency.

Post Reply