FLOAT variable not working?
Moderator: Benj
FLOAT variable not working?
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 346 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: FLOAT variable not working?
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.
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
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: FLOAT variable not working?
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel