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

Posts: 15
Joined: Sat Aug 10, 2013 7:16 am
Been thanked: 1 time

FLOAT variable not working?

Postby imtiaz9 » Tue Oct 24, 2017 2:25 pm

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

User avatar
Matrix Staff
Posts: 2009
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 688 times

Re: FLOAT variable not working?

Postby LeighM » Tue Oct 24, 2017 2:38 pm

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.

Posts: 8
Joined: Sun Apr 21, 2019 5:16 pm
Has thanked: 3 times

Re: FLOAT variable not working?

Postby Halcon0653 » Wed May 01, 2019 10:15 am

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

User avatar
Matrix Staff
Posts: 14786
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4750 times
Been thanked: 4358 times

Re: FLOAT variable not working?

Postby Benj » Wed Oct 02, 2019 9:50 am

Try this instead and you should get the right result.


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.