After Rounding to two decimal places, i alwayse get the same value
float TestT =round(t*100)/100;
i would like to round it and fix it to two decimal places: 0.009999 -> 0.01
After Rounding to two decimal places, i alwayse get the same value
float TestT =round(t*100)/100;
i would like to round it and fix it to two decimal places: 0.009999 -> 0.01
You can do this in 2 steps:-
Step1:- transform your float value to string and use the inbuilt QString feature to perform the rounding for you
Eg:-
Step2:- transform your rounded string value to float Eg:-
More info about this here is some links:- QString":http://qt-project.org/doc/qt-5.0/qtcore/qstring.html#number-2 may help you.