Svdmerwe Posted December 19, 2017 Share Posted December 19, 2017 Trying to do calculations on float variable. Example: The expected result of TestFloatA should be 0.254000 but wh en get 0? Anyone experienced this on C4. Running v2.9. Link to comment Share on other sites More sharing options...
brucecampbell Posted January 14, 2018 Share Posted January 14, 2018 I've never had a need to use a float variable so far... But I'd do some debugging. first - obviously - check your variable is float, not int second, try manually setting the value in the value box and see if it holds. or, try a single decimal to see if that value holds and work up from there. Link to comment Share on other sites More sharing options...
Cyknight Posted January 15, 2018 Share Posted January 15, 2018 Remove the "0" and see if it gives you result. If it does, there's a chance the system is processing the second command before actually executing the first - but a 500ms delay in there and see if it works (can try 100ms after confirming it works on 500) Link to comment Share on other sites More sharing options...
Ale Quiroga Posted February 12, 2018 Share Posted February 12, 2018 Try to time delay between commands, for example i try float variables to check nest thermostat temperature and works Link to comment Share on other sites More sharing options...
Svdmerwe Posted February 13, 2018 Author Share Posted February 13, 2018 I have found the following: - assigning a float value to the float variable works, no problem example assigning 0.254 to TestFloatA variable of type float. - the problem is with adding to that value: I tested the following: added 0.254 five times to TestFloatA (with an initial value of 0.254) - did it by manually executing a piece of code 5 times (pressing EXECUTE button) the expected result should have been 1.524 but the result is 0 added 1.254 five times to TestFloatD (with an initial value of 0) the expected result should have been 6.27 but the result is 5 Conclusion: it seems as if the value to the right of the decimal sign is ignored when adding (+) values (Note: I have tried to use delays but it does not make a difference) Link to comment Share on other sites More sharing options...
brucecampbell Posted February 13, 2018 Share Posted February 13, 2018 This sounds really weird - I might do some testing myself when time permits... Link to comment Share on other sites More sharing options...
brucecampbell Posted February 13, 2018 Share Posted February 13, 2018 My testing confirms the same problem. You can programmatically set the float variable to a floating point value such as 2.954 However the 'Set to Random Value Between' and the '+' programming options in composer are not working. I'm assuming it is not simply a display issue, as the 'Set to Value' is working fine and you can see the variable has a value with decimals. Likely a bug where the developer has referenced the value as integer instead of float/double/decimal. Probably need someone @ C4 like @Derrick Cain who has been active on the forums before to have a look, or push this to the right person. Link to comment Share on other sites More sharing options...
CFUG Posted March 7, 2018 Share Posted March 7, 2018 ^Same, same. Bug. Link to comment Share on other sites More sharing options...
Svdmerwe Posted March 7, 2018 Author Share Posted March 7, 2018 So how/to whom do we escalate? Link to comment Share on other sites More sharing options...
RyanE Posted March 7, 2018 Share Posted March 7, 2018 I was going to enter a defect on this issue, but can't reproduce it on the upcoming 2.10.2 release. I added the same 1.254 value 5x times, and came up with the correct result (6.27). I tried the random between 0 and 100, and got 85.377, and a different value (again, with 3 digits precision) when I executed it again. I don't have a timeframe or schedule for when it will release, but it appears this has already been addressed in 2.10.2. Thanks for bringing it up. RyanE Link to comment Share on other sites More sharing options...
knowitall Posted March 7, 2018 Share Posted March 7, 2018 omg did a C4 employee just spill the beans on an upcoming OS release!!??!!?!!?? Link to comment Share on other sites More sharing options...
RyanE Posted March 8, 2018 Share Posted March 8, 2018 4 hours ago, knowitall said: omg did a C4 employee just spill the beans on an upcoming OS release!!??!!?!!?? As much as I ever will... RyanE Link to comment Share on other sites More sharing options...
Svdmerwe Posted March 8, 2018 Author Share Posted March 8, 2018 Thank you for the feedback. Link to comment Share on other sites More sharing options...
Svdmerwe Posted March 8, 2018 Author Share Posted March 8, 2018 Hopefully I can upgrade to the new version. Had some trouble to upgrade to 2.10 and as result is still on 2.9. Link to comment Share on other sites More sharing options...
CFUG Posted March 9, 2018 Share Posted March 9, 2018 What can be done for those who must stay on 2.9? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.