float mass[2][100];QString str;for (int i=0;i<100;i++){mass[0][i]=0;mass[1][i]=0;}mass[0][0]=0.045;mass[1][0]=20*log10(mass[0][0]/0.45);for (int i=1;i<100;i++){mass[0][i]=mass[0][i-1]+0.225;mass[1][i]=20*log10(mass[0][i]/0.45);str.sprintf("%4.2f",mass[1][i]);mass[1][i]=str.toFloat();}
C++ (Qt)qRound(value * 100) / 100.0
C++ (Qt)(float)qRound(value * 100) / 100
#include <math.h>//...........double roundDouble(double doValue, int nPrecision){ static const double doBase = 10.0; double doComplete5, doComplete5i; doComplete5 = doValue * pow(doBase, (double) (nPrecision + 1)); if (doValue < 0.0) doComplete5 -= 5.0; else doComplete5 += 5.0; doComplete5 /= doBase; modf(doComplete5, &doComplete5i); return doComplete5i / pow(doBase, (double) nPrecision);}
#include <math.h>double round(double x);
qreal V=0.01*floor(100*(Vol)+0.5);